<%= gettext("Listing Ammo Types") %>

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

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

<%= live_patch(dgettext("actions", "Add your first type!"), to: Routes.ammo_type_index_path(@socket, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch(dgettext("actions", "New Ammo type"), to: Routes.ammo_type_index_path(@socket, :new), class: "btn btn-primary" ) %>
<%= for field_name <- [ gettext("Name"), gettext("Bullet type"), gettext("Bullet core"), gettext("Cartridge"), gettext("Caliber"), gettext("Case material"), gettext("Grains"), gettext("Pressure"), gettext("Primer type"), gettext("Rimfire"), gettext("Tracer"), gettext("Incendiary"), gettext("Blank"), gettext("Corrosive"), gettext("Manufacturer"), gettext("Sku") ] do %> <% end %> <%= for ammo_type <- @ammo_types do %> <%= for field <- [ :name, :bullet_type, :bullet_core, :cartridge, :caliber, :case_material, :grains, :pressure, :primer_type ] do %> <% end %> <%= for field <- [ :rimfire, :tracer, :incendiary, :blank, :corrosive ] do %> <% end %> <%= for field <- [:manufacturer, :sku] do %> <% end %> <% end %>
<%= field_name %>
<%= ammo_type |> Map.get(field) %> <%= ammo_type |> Map.get(field) |> humanize() %> <%= ammo_type |> Map.get(field) %>
<%= live_redirect to: Routes.ammo_type_show_path(@socket, :show, ammo_type), class: "text-primary-500 link" do %> <% end %> <%= live_patch to: Routes.ammo_type_index_path(@socket, :edit, ammo_type), class: "text-primary-500 link" do %> <% end %> <%= link to: "#", class: "text-primary-500 link", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: dgettext("prompts", "Are you sure you want to delete this ammo?")] do %> <% end %>
<% end %>
<%= if @live_action in [:new, :edit] do %> <%= live_modal(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(@socket, :index) ) %> <% end %>