2022-02-05 01:59:40 -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_group.ammo_type.name %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<div class="space-y-2 flex flex-col justify-center items-center">
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:20:04 -05:00
|
|
|
<%= gettext("Count:") %>
|
|
|
|
<%= @ammo_group.count %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</span>
|
|
|
|
|
|
|
|
<%= if @ammo_group.notes do %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:20:04 -05:00
|
|
|
<%= gettext("Notes:") %>
|
|
|
|
<%= @ammo_group.notes %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= if @ammo_group.price_paid do %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-15 22:33:36 -05:00
|
|
|
<%= gettext("Price paid:") %>
|
|
|
|
<%= gettext("$%{amount}", amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)) %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="flex space-x-4 justify-center items-center text-primary-500">
|
2022-02-15 17:33:45 -05:00
|
|
|
<%= live_patch(dgettext("actions", "Ammo Details"),
|
2022-02-15 18:20:12 -05:00
|
|
|
to: Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type),
|
2022-02-15 17:33:45 -05:00
|
|
|
class: "btn btn-primary"
|
|
|
|
) %>
|
|
|
|
|
2022-02-15 18:20:12 -05:00
|
|
|
<%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group),
|
2022-02-05 01:59:40 -05:00
|
|
|
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",
|
2022-02-09 00:20:04 -05:00
|
|
|
data: [confirm: dgettext("prompts", "Are you sure you want to delete this ammo?")] do %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
|
|
|
<% end %>
|
2022-02-15 17:33:45 -05:00
|
|
|
|
|
|
|
<button type="button" class="btn btn-primary" phx-click="toggle_staged">
|
|
|
|
<%= if @ammo_group.staged, do: gettext("Unstage from range"), else: gettext("Stage for range") %>
|
|
|
|
</button>
|
2022-02-15 18:20:12 -05:00
|
|
|
|
|
|
|
<%= live_patch(dgettext("actions", "Move to different container"),
|
|
|
|
to: Routes.ammo_group_show_path(Endpoint, :move, @ammo_group),
|
|
|
|
class: "btn btn-primary"
|
|
|
|
) %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr class="mb-4 w-full">
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<%= if @ammo_group.container do %>
|
|
|
|
<h1 class="mb-4 px-4 py-2 text-center rounded-lg title text-xl">
|
2022-02-09 00:20:04 -05:00
|
|
|
<%= gettext("Stored in") %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
<.container_card container={@ammo_group.container} />
|
|
|
|
<% else %>
|
2022-02-09 00:20:04 -05:00
|
|
|
<%= gettext("This ammo group is not in a container") %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-02-15 18:20:12 -05:00
|
|
|
<%= case @live_action do %>
|
|
|
|
<% :edit -> %>
|
|
|
|
<.modal return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}>
|
|
|
|
<.live_component
|
|
|
|
module={CanneryWeb.AmmoGroupLive.FormComponent}
|
|
|
|
id={@ammo_group.id}
|
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
ammo_group={@ammo_group}
|
|
|
|
return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}
|
|
|
|
current_user={@current_user}
|
|
|
|
/>
|
|
|
|
</.modal>
|
|
|
|
|
|
|
|
<% :add_shot_group -> %>
|
|
|
|
<.modal return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}>
|
|
|
|
<.live_component
|
|
|
|
module={CanneryWeb.Components.AddShotGroupComponent}
|
|
|
|
id={:new}
|
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
ammo_group={@ammo_group}
|
|
|
|
return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}
|
|
|
|
current_user={@current_user}
|
|
|
|
/>
|
|
|
|
</.modal>
|
|
|
|
|
|
|
|
<% :move -> %>
|
|
|
|
<.modal return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}>
|
|
|
|
<.live_component
|
|
|
|
module={CanneryWeb.Components.MoveAmmoGroupComponent}
|
|
|
|
id={@ammo_group.id}
|
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
ammo_group={@ammo_group}
|
|
|
|
return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}
|
|
|
|
current_user={@current_user}
|
|
|
|
/>
|
|
|
|
</.modal>
|
2022-02-15 17:33:45 -05:00
|
|
|
|
2022-02-15 18:20:12 -05:00
|
|
|
<% _show -> %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<% end %>
|