Listing Ammo Types

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

No Ammo Types 😔

<%= live_patch("Add your first type!", to: Routes.ammo_type_index_path(@socket, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch("New Ammo type", to: Routes.ammo_type_index_path(@socket, :new), class: "btn btn-primary" ) %>
<%= for field <- [ :name, :bullet_type, :bullet_core, :cartridge, :caliber, :case_material, :grains, :pressure, :primer_type, :rimfire, :tracer, :incendiary, :blank, :corrosive, :manufacturer, :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 |> humanize() %>
<%= 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: "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 %>