<%= @ammo_type.name %>

<%= if @ammo_type.desc do %> <%= @ammo_type.desc %> <% end %>
<%= live_patch to: Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type), class: "text-primary-600 link", data: [qa: "edit"] do %> <% end %> <%= link to: "#", class: "text-primary-600 link", phx_click: "delete", data: [ confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: @ammo_type.name), qa: "delete" ] do %> <% end %>

<%= for {field_name, field} <- [ {gettext("Bullet type"), :bullet_type}, {gettext("Bullet core"), :bullet_core}, {gettext("Cartridge"), :cartridge}, {gettext("Caliber"), :caliber}, {gettext("Case material"), :case_material}, {gettext("Jacket type"), :jacket_type}, {gettext("Muzzle velocity"), :muzzle_velocity}, {gettext("Powder type"), :powder_type}, {gettext("Powder grains per charge"), :powder_grains_per_charge}, {gettext("Grains"), :grains}, {gettext("Pressure"), :pressure}, {gettext("Primer type"), :primer_type} ] do %> <%= if @ammo_type |> Map.get(field) do %>

<%= field_name %>:

<%= @ammo_type |> Map.get(field) %> <% end %> <% end %> <%= for {field_name, field} <- [ {"Rimfire", :rimfire}, {"Tracer", :tracer}, {"Incendiary", :incendiary}, {"Blank", :blank}, {"Corrosive", :corrosive} ] do %>

<%= field_name %>:

<%= @ammo_type |> Map.get(field) |> humanize() %> <% end %> <%= for {field_name, field} <- [{"Manufacturer", :manufacturer}, {"UPC", :upc}] do %> <%= if @ammo_type |> Map.get(field) do %>

<%= field_name %>:

<%= @ammo_type |> Map.get(field) %> <% end %> <% end %> <%= if @avg_cost_per_round do %>

<%= gettext("Average Price paid") %>:

<%= gettext("$%{amount}", amount: @avg_cost_per_round |> :erlang.float_to_binary(decimals: 2) ) %> <% end %>

<%= if @ammo_groups |> Enum.empty?() do %> <%= gettext("No ammo for this type") %> <% else %>
<%= for ammo_group <- @ammo_groups do %> <.ammo_group_card ammo_group={ammo_group} /> <% end %>
<% end %>
<%= if @live_action in [:edit] do %> <.modal return_to={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}> <.live_component module={CanneryWeb.AmmoTypeLive.FormComponent} id={@ammo_type.id} title={@page_title} action={@live_action} ammo_type={@ammo_type} return_to={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} current_user={@current_user} /> <% end %>