cannery/lib/cannery_web/live/ammo_type_live/show.html.heex

74 lines
2.1 KiB
Plaintext
Raw Normal View History

2022-01-31 23:20:57 -05:00
<div class="mx-auto space-y-4 max-w-3xl flex flex-col justify-center items-center">
<h1 class="title text-2xl title-primary-500">
<%= @ammo_type.name %>
</h1>
2022-02-05 01:59:40 -05:00
<div class="space-y-2 flex flex-col justify-center items-center">
<%= if @ammo_type.desc do %>
<span class="rounded-lg title text-lg">
Desc: <%= @ammo_type.desc %>
</span>
<% end %>
<%= if @ammo_type.case_material do %>
<span class="rounded-lg title text-lg">
Case material: <%= @ammo_type.case_material %>
</span>
<% end %>
<%= if @ammo_type.bullet_type do %>
<span class="rounded-lg title text-lg">
Bullet type: <%= @ammo_type.bullet_type %>
</span>
<% end %>
<%= if @ammo_type.grain do %>
<span class="rounded-lg title text-lg">
Grain: <%= @ammo_type.grain %>
</span>
<% end %>
<%= if @ammo_type.manufacturer do %>
<span class="rounded-lg title text-lg">
Manufacturer: <%= @ammo_type.manufacturer %>
</span>
<% end %>
</div>
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 01:59:40 -05:00
<hr class="mb-4 w-full">
<div class="mb-4">
<%= 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 %>