167 lines
4.9 KiB
Plaintext
167 lines
4.9 KiB
Plaintext
<div class="space-y-4 flex flex-col justify-center items-center">
|
|
<h1 class="title text-2xl title-primary-500">
|
|
<%= @container.name %>
|
|
</h1>
|
|
|
|
<span :if={@container.desc} class="rounded-lg title text-lg">
|
|
<%= gettext("Description:") %>
|
|
<%= @container.desc %>
|
|
</span>
|
|
|
|
<span class="rounded-lg title text-lg">
|
|
<%= gettext("Type:") %>
|
|
<%= @container.type %>
|
|
</span>
|
|
|
|
<span :if={@container.location} class="rounded-lg title text-lg">
|
|
<%= gettext("Location:") %>
|
|
<%= @container.location %>
|
|
</span>
|
|
|
|
<%= unless @ammo_groups |> Enum.empty?() do %>
|
|
<span class="rounded-lg title text-lg">
|
|
<%= if @show_used do %>
|
|
<%= gettext("Total packs:") %>
|
|
<% else %>
|
|
<%= gettext("Packs:") %>
|
|
<% end %>
|
|
<%= Enum.count(@ammo_groups) %>
|
|
</span>
|
|
|
|
<span class="rounded-lg title text-lg">
|
|
<%= if @show_used do %>
|
|
<%= gettext("Total rounds:") %>
|
|
<% else %>
|
|
<%= gettext("Rounds:") %>
|
|
<% end %>
|
|
<%= @container |> Containers.get_container_rounds!() %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
|
<.link
|
|
patch={Routes.container_show_path(Endpoint, :edit, @container)}
|
|
class="text-primary-600 link"
|
|
aria-label={gettext("Edit %{container_name}", container_name: @container.name)}
|
|
>
|
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
|
</.link>
|
|
|
|
<.link
|
|
href="#"
|
|
class="text-primary-600 link"
|
|
phx-click="delete_container"
|
|
data-confirm={
|
|
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
|
|
}
|
|
aria-label={gettext("Delete %{container_name}", container_name: @container.name)}
|
|
>
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
|
</.link>
|
|
</div>
|
|
|
|
<hr class="mb-4 hr" />
|
|
|
|
<%= if @container.tags |> Enum.empty?() do %>
|
|
<div class="flex flex-row justify-center items-center space-x-4">
|
|
<h2 class="title text-lg text-primary-600">
|
|
<%= gettext("No tags for this container") %>
|
|
<%= display_emoji("😔") %>
|
|
</h2>
|
|
|
|
<.link
|
|
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
|
class="btn btn-primary"
|
|
>
|
|
<%= dgettext("actions", "Why not add one?") %>
|
|
</.link>
|
|
</div>
|
|
<% else %>
|
|
<div class="flex flex-wrap justify-center items-center">
|
|
<.simple_tag_card :for={tag <- @container.tags} tag={tag} />
|
|
|
|
<div class="mx-4 my-2">
|
|
<.link
|
|
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
|
class="text-primary-600 link"
|
|
>
|
|
<i class="fa-fw fa-lg fas fa-tags"></i>
|
|
</.link>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<hr class="mb-4 hr" />
|
|
|
|
<div class="flex justify-center items-center space-x-4">
|
|
<.toggle_button action="toggle_show_used" value={@show_used}>
|
|
<span class="title text-lg text-primary-600">
|
|
<%= gettext("Show used") %>
|
|
</span>
|
|
</.toggle_button>
|
|
|
|
<.toggle_button action="toggle_table" value={@view_table}>
|
|
<span class="title text-lg text-primary-600">
|
|
<%= gettext("View as table") %>
|
|
</span>
|
|
</.toggle_button>
|
|
</div>
|
|
|
|
<div class="w-full p-4">
|
|
<%= if @ammo_groups |> Enum.empty?() do %>
|
|
<h2 class="mx-4 title text-lg text-primary-600 text-center">
|
|
<%= gettext("No ammo in this container") %>
|
|
</h2>
|
|
<% else %>
|
|
<%= if @view_table do %>
|
|
<.live_component
|
|
module={CanneryWeb.Components.AmmoGroupTableComponent}
|
|
id="ammo-type-show-table"
|
|
ammo_groups={@ammo_groups}
|
|
current_user={@current_user}
|
|
>
|
|
<:ammo_type :let={%{name: ammo_type_name} = ammo_type}>
|
|
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="link">
|
|
<%= ammo_type_name %>
|
|
</.link>
|
|
</:ammo_type>
|
|
</.live_component>
|
|
<% else %>
|
|
<div class="flex flex-wrap justify-center items-stretch">
|
|
<.ammo_group_card :for={ammo_group <- @ammo_groups} ammo_group={ammo_group} />
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<.modal
|
|
:if={@live_action == :edit}
|
|
return_to={Routes.container_show_path(Endpoint, :show, @container)}
|
|
>
|
|
<.live_component
|
|
module={CanneryWeb.ContainerLive.FormComponent}
|
|
id={@container.id}
|
|
title={@page_title}
|
|
action={@live_action}
|
|
container={@container}
|
|
return_to={Routes.container_show_path(Endpoint, :show, @container)}
|
|
current_user={@current_user}
|
|
/>
|
|
</.modal>
|
|
|
|
<.modal
|
|
:if={@live_action == :edit_tags}
|
|
return_to={Routes.container_show_path(Endpoint, :show, @container)}
|
|
>
|
|
<.live_component
|
|
module={CanneryWeb.ContainerLive.EditTagsComponent}
|
|
id={@container.id}
|
|
title={@page_title}
|
|
action={@live_action}
|
|
container={@container}
|
|
return_to={Routes.container_show_path(Endpoint, :show, @container)}
|
|
current_user={@current_user}
|
|
/>
|
|
</.modal>
|