<%= gettext("Range day") %>

<%= if @ammo_groups |> Enum.empty?() do %>

<%= gettext("No ammo staged") %> <%= display_emoji("😔") %>

<.link navigate={Routes.ammo_group_index_path(Endpoint, :index)} class="btn btn-primary"> <%= dgettext("actions", "Why not get some ready to shoot?") %> <% else %> <.link navigate={Routes.ammo_group_index_path(Endpoint, :index)} class="btn btn-primary"> <%= dgettext("actions", "Stage ammo") %>
<.ammo_group_card :for={ammo_group <- @ammo_groups} ammo_group={ammo_group}> <.link patch={Routes.range_index_path(Endpoint, :add_shot_group, ammo_group)} class="btn btn-primary" > <%= dgettext("actions", "Record shots") %>
<% end %>
<%= if @shot_groups |> Enum.empty?() and @search |> is_nil() do %>

<%= gettext("No shots recorded") %> <%= display_emoji("😔") %>

<% else %>

<%= gettext("Shot log") %>

<%= dgettext("errors", "Your browser does not support the canvas element.") %>
<.form :let={f} for={:search} phx-change="search" phx-submit="search" class="grow self-stretch flex flex-col items-stretch" > <%= text_input(f, :search_term, class: "input input-primary", value: @search, phx_debounce: 300, placeholder: gettext("Search shot records") ) %>
<%= if @shot_groups |> Enum.empty?() do %>

<%= gettext("No shots recorded") %> <%= display_emoji("😔") %>

<% else %> <.live_component module={CanneryWeb.Components.ShotGroupTableComponent} id="shot_groups_index_table" shot_groups={@shot_groups} current_user={@current_user} > <:actions :let={shot_group}>
<.link patch={Routes.range_index_path(Endpoint, :edit, shot_group)} class="text-primary-600 link" aria-label={ gettext("Edit shot record of %{shot_group_count} shots", shot_group_count: shot_group.count ) } > <.link href="#" class="text-primary-600 link" phx-click="delete" phx-value-id={shot_group.id} data-confirm={ dgettext("prompts", "Are you sure you want to delete this shot record?") } aria-label={ gettext("Delete shot record of %{shot_group_count} shots", shot_group_count: shot_group.count ) } >
<% end %> <% end %>
<.modal :if={@live_action == :edit} return_to={Routes.range_index_path(Endpoint, :index)}> <.live_component module={CanneryWeb.RangeLive.FormComponent} id={@shot_group.id} title={@page_title} action={@live_action} shot_group={@shot_group} return_to={Routes.range_index_path(Endpoint, :index)} current_user={@current_user} /> <.modal :if={@live_action == :add_shot_group} return_to={Routes.range_index_path(Endpoint, :index)} > <.live_component module={CanneryWeb.Components.AddShotGroupComponent} id={:new} title={@page_title} action={@live_action} ammo_group={@ammo_group} return_to={Routes.range_index_path(Endpoint, :index)} current_user={@current_user} />