<%= gettext("Catalog") %>

<%= if @types_count == 0 do %>

<%= gettext("No Types") %> <%= display_emoji("😔") %>

<.link patch={Routes.type_index_path(Endpoint, :new)} class="btn btn-primary"> <%= dgettext("actions", "Add your first type!") %> <% else %> <.link patch={Routes.type_index_path(Endpoint, :new)} class="btn btn-primary"> <%= dgettext("actions", "New Type") %>
<.form :let={f} for={%{}} as={:type} phx-change="change_class" phx-submit="change_class" class="flex items-center" > <%= label(f, :class, gettext("Class"), class: "title text-primary-600 text-lg text-center") %> <%= select( f, :class, [ {gettext("All"), :all}, {gettext("Rifle"), :rifle}, {gettext("Shotgun"), :shotgun}, {gettext("Pistol"), :pistol} ], class: "mx-2 my-1 min-w-md input input-primary", value: @class ) %> <.form :let={f} for={%{}} as={:search} phx-change="search" phx-submit="search" class="grow flex items-center" > <%= text_input(f, :search_term, class: "grow 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 @types |> Enum.empty?() do %>

<%= gettext("No Types") %> <%= display_emoji("😔") %>

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