<%= @ammo_type.name %>

<%= if @ammo_type.desc do %> <%= @ammo_type.desc %> <% end %>
<%= live_patch to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), class: "text-primary-500 link" do %> <% end %> <%= link to: "#", class: "text-primary-500 link", phx_click: "delete", data: [ confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: @ammo_type.name) ] 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("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}, {"Sku", :sku}] 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") %> :

<%= @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 %> <%= live_modal(CanneryWeb.AmmoTypeLive.FormComponent, id: @ammo_type.id, title: @page_title, action: @live_action, ammo_type: @ammo_type, return_to: Routes.ammo_type_show_path(@socket, :show, @ammo_type) ) %> <% end %>