<%= gettext("Catalog") %>

<%= if @ammo_types |> Enum.empty?() and @search |> is_nil() do %>

<%= gettext("No Ammo types") %> <%= display_emoji("😔") %>

<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary"> <%= dgettext("actions", "Add your first type!") %> <% else %> <.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary"> <%= dgettext("actions", "New Ammo type") %>
<.form :let={f} for={%{}} as={: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, role: "search", phx_debounce: 300, placeholder: gettext("Search catalog") ) %> <.toggle_button action="toggle_show_used" value={@show_used}> <%= gettext("Show used") %>
<%= if @ammo_types |> Enum.empty?() do %>

<%= gettext("No Ammo types") %> <%= display_emoji("😔") %>

<% else %> <.live_component module={CanneryWeb.Components.AmmoTypeTableComponent} id="ammo_types_index_table" action={@live_action} ammo_types={@ammo_types} current_user={@current_user} show_used={@show_used} > <:actions :let={ammo_type}>
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="text-primary-600 link" aria-label={ dgettext("actions", "View %{ammo_type_name}", ammo_type_name: ammo_type.name) } > <.link patch={Routes.ammo_type_index_path(Endpoint, :edit, ammo_type)} class="text-primary-600 link" aria-label={ dgettext("actions", "Edit %{ammo_type_name}", ammo_type_name: ammo_type.name) } > <.link patch={Routes.ammo_type_index_path(Endpoint, :clone, ammo_type)} class="text-primary-600 link" aria-label={ dgettext("actions", "Clone %{ammo_type_name}", ammo_type_name: ammo_type.name) } > <.link href="#" class="text-primary-600 link" phx-click="delete" phx-value-id={ammo_type.id} data-confirm={ dgettext( "prompts", "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!", name: ammo_type.name ) } aria-label={ dgettext("actions", "Delete %{ammo_type_name}", ammo_type_name: ammo_type.name) } >
<% end %> <% end %>
<.modal :if={@live_action in [:new, :edit, :clone]} return_to={Routes.ammo_type_index_path(Endpoint, :index)} > <.live_component module={CanneryWeb.AmmoTypeLive.FormComponent} id={@ammo_type.id || :new} title={@page_title} action={@live_action} ammo_type={@ammo_type} return_to={Routes.ammo_type_index_path(Endpoint, :index)} current_user={@current_user} } />