2022-02-05 16:22:02 -05:00
|
|
|
<div class="mx-auto px-4 sm:px-8 space-y-4 max-w-3xl
|
|
|
|
flex flex-col justify-center items-center">
|
2022-01-31 23:20:57 -05:00
|
|
|
<h1 class="title text-2xl title-primary-500">
|
|
|
|
<%= @ammo_type.name %>
|
|
|
|
</h1>
|
|
|
|
|
2022-02-05 16:22:02 -05:00
|
|
|
<%= if @ammo_type.desc do %>
|
|
|
|
<span class="max-w-2xl w-full px-8 py-4 rounded-lg
|
|
|
|
text-center title text-lg
|
|
|
|
border border-primary-600">
|
|
|
|
<%= @ammo_type.desc %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
2022-02-05 01:59:40 -05:00
|
|
|
|
2022-01-31 23:20:57 -05:00
|
|
|
<div class="flex space-x-4 justify-center items-center text-primary-500">
|
2022-02-05 01:59:40 -05:00
|
|
|
<%= live_patch to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type),
|
|
|
|
class: "text-primary-500 link" do %>
|
|
|
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= link to: "#",
|
|
|
|
class: "text-primary-500 link",
|
|
|
|
phx_click: "delete",
|
|
|
|
data: [confirm: "Are you sure you want to delete #{@ammo_type.name}?"] do %>
|
|
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
|
|
|
<% end %>
|
2022-01-31 23:20:57 -05:00
|
|
|
</div>
|
|
|
|
|
2022-02-05 16:22:02 -05:00
|
|
|
<hr class="hr">
|
|
|
|
|
|
|
|
<div class="grid sm:grid-cols-2 text-center justify-center items-center">
|
|
|
|
<%= for field <- [
|
|
|
|
:bullet_type,
|
|
|
|
:bullet_core,
|
|
|
|
:cartridge,
|
|
|
|
:caliber,
|
|
|
|
:case_material,
|
|
|
|
:grains,
|
|
|
|
:pressure
|
|
|
|
] do %>
|
|
|
|
<%= if @ammo_type |> Map.get(field) do %>
|
|
|
|
<h3 class="mb-2 sm:mr-4 title text-lg">
|
|
|
|
<%= field |> humanize() %> :
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<span class="mb-4 sm:mb-2 text-primary-600">
|
|
|
|
<%= @ammo_type |> Map.get(field) %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= for field <- [
|
|
|
|
:rimfire,
|
|
|
|
:tracer,
|
|
|
|
:incendiary,
|
|
|
|
:blank,
|
|
|
|
:corrosive
|
|
|
|
] do %>
|
|
|
|
<h3 class="mb-2 sm:mr-4 title text-lg">
|
|
|
|
<%= field |> humanize() %> :
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<span class="mb-4 sm:mb-2 text-primary-600">
|
|
|
|
<%= @ammo_type |> Map.get(field) |> humanize() %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= for field <- [:manufacturer, :sku] do %>
|
|
|
|
<%= if @ammo_type |> Map.get(field) do %>
|
|
|
|
<h3 class="mb-2 sm:mr-4 title text-lg">
|
|
|
|
<%= field |> humanize() %> :
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<span class="mb-4 sm:mb-2 text-primary-600">
|
|
|
|
<%= @ammo_type |> Map.get(field) %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr class="hr">
|
2022-02-05 01:59:40 -05:00
|
|
|
|
2022-02-05 16:22:02 -05:00
|
|
|
<div>
|
2022-02-05 01:59:40 -05:00
|
|
|
<%= if @ammo_type.ammo_groups |> Enum.empty?() do %>
|
|
|
|
No ammo for this type
|
|
|
|
<% else %>
|
|
|
|
<%= for ammo_group <- @ammo_type.ammo_groups do %>
|
|
|
|
<.ammo_group_card ammo_group={ammo_group} />
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2022-01-31 23:20:57 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<%= if @live_action in [:edit] do %>
|
2022-02-01 01:08:18 -05:00
|
|
|
<%= live_modal(CanneryWeb.AmmoTypeLive.FormComponent,
|
2022-01-31 23:20:57 -05:00
|
|
|
id: @ammo_type.id,
|
|
|
|
title: @page_title,
|
|
|
|
action: @live_action,
|
|
|
|
ammo_type: @ammo_type,
|
2022-02-01 01:08:18 -05:00
|
|
|
return_to: Routes.ammo_type_show_path(@socket, :show, @ammo_type)
|
|
|
|
) %>
|
2022-01-31 23:20:57 -05:00
|
|
|
<% end %>
|