137 lines
4.0 KiB
Plaintext
137 lines
4.0 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>
|
|
|
|
<%= if @container.desc do %>
|
|
<span class="rounded-lg title text-lg">
|
|
<%= gettext("Description:") %>
|
|
<%= @container.desc %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
|
<%= gettext("Type:") %>
|
|
<%= @container.type %>
|
|
</span>
|
|
|
|
<%= if @container.location do %>
|
|
<span class="rounded-lg title text-lg">
|
|
<%= gettext("Location:") %>
|
|
<%= @container.location %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<%= unless @ammo_groups |> Enum.empty?() do %>
|
|
<span class="rounded-lg title text-lg">
|
|
<%= gettext("Packs:") %>
|
|
<%= Enum.count(@ammo_groups) %>
|
|
</span>
|
|
|
|
<span class="rounded-lg title text-lg">
|
|
<%= gettext("Rounds:") %>
|
|
<%= @container |> Containers.get_container_rounds!() %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
|
<%= live_patch to: Routes.container_show_path(Endpoint, :edit, @container),
|
|
class: "text-primary-600 link",
|
|
data: [qa: "edit"] do %>
|
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
|
<% end %>
|
|
|
|
<%= link to: "#",
|
|
class: "text-primary-600 link",
|
|
phx_click: "delete_container",
|
|
data: [
|
|
confirm:
|
|
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name),
|
|
qa: "delete"
|
|
] do %>
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
|
<% end %>
|
|
</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>
|
|
|
|
<%= live_patch(dgettext("actions", "Why not add one?"),
|
|
to: Routes.container_show_path(Endpoint, :edit_tags, @container),
|
|
class: "btn btn-primary"
|
|
) %>
|
|
</div>
|
|
<% else %>
|
|
<div class="flex flex-wrap justify-center items-center">
|
|
<%= for tag <- @container.tags do %>
|
|
<.simple_tag_card tag={tag} />
|
|
<% end %>
|
|
|
|
<div class="mx-4 my-2">
|
|
<%= live_patch to: Routes.container_show_path(Endpoint, :edit_tags, @container),
|
|
class: "text-primary-600 link" do %>
|
|
<i class="fa-fw fa-lg fas fa-tags"></i>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<hr class="mb-4 hr" />
|
|
|
|
<div class="flex flex-col justify-center items-center">
|
|
<.toggle_button action="toggle_show_used" value={@show_used}>
|
|
<span class="title text-lg text-primary-600">
|
|
<%= gettext("Show used") %>
|
|
</span>
|
|
</.toggle_button>
|
|
</div>
|
|
|
|
<div>
|
|
<%= if @ammo_groups |> Enum.empty?() do %>
|
|
<h2 class="mx-8 my-4 title text-lg text-primary-600">
|
|
<%= gettext("No ammo in this container") %>
|
|
</h2>
|
|
<% else %>
|
|
<div class="flex flex-wrap justify-center items-center">
|
|
<%= for ammo_group <- @ammo_groups do %>
|
|
<.ammo_group_card ammo_group={ammo_group} />
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= if @live_action in [:edit] do %>
|
|
<.modal 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>
|
|
<% end %>
|
|
|
|
<%= if @live_action == :edit_tags do %>
|
|
<.modal 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>
|
|
<% end %>
|