2022-11-06 23:12:17 -05:00
|
|
|
<div class="space-y-4 flex flex-col justify-center items-center">
|
2022-01-31 21:56:02 -05:00
|
|
|
<h1 class="title text-2xl title-primary-500">
|
|
|
|
<%= @container.name %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<%= if @container.desc do %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:49:47 -05:00
|
|
|
<%= gettext("Description:") %>
|
|
|
|
<%= @container.desc %>
|
2022-01-31 21:56:02 -05:00
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:49:47 -05:00
|
|
|
<%= gettext("Type:") %>
|
|
|
|
<%= @container.type %>
|
2022-01-31 21:56:02 -05:00
|
|
|
</span>
|
|
|
|
|
|
|
|
<%= if @container.location do %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:49:47 -05:00
|
|
|
<%= gettext("Location:") %>
|
|
|
|
<%= @container.location %>
|
2022-01-31 21:56:02 -05:00
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
|
2022-11-07 00:37:53 -05:00
|
|
|
<%= unless @ammo_groups |> Enum.empty?() do %>
|
2022-07-01 19:13:54 -04:00
|
|
|
<span class="rounded-lg title text-lg">
|
2022-11-19 12:01:28 -05:00
|
|
|
<%= if @show_used do %>
|
|
|
|
<%= gettext("Total packs:") %>
|
|
|
|
<% else %>
|
|
|
|
<%= gettext("Packs:") %>
|
|
|
|
<% end %>
|
2022-11-07 00:37:53 -05:00
|
|
|
<%= Enum.count(@ammo_groups) %>
|
2022-07-01 19:13:54 -04:00
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-11-19 12:01:28 -05:00
|
|
|
<%= if @show_used do %>
|
|
|
|
<%= gettext("Total rounds:") %>
|
|
|
|
<% else %>
|
|
|
|
<%= gettext("Rounds:") %>
|
|
|
|
<% end %>
|
2022-07-01 19:13:54 -04:00
|
|
|
<%= @container |> Containers.get_container_rounds!() %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
|
2022-02-17 22:29:01 -05:00
|
|
|
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
patch={Routes.container_show_path(Endpoint, :edit, @container)}
|
|
|
|
class="text-primary-600 link"
|
|
|
|
data-qa="edit"
|
|
|
|
>
|
2022-02-05 01:59:40 -05:00
|
|
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-02-05 01:59:40 -05:00
|
|
|
|
2022-11-07 22:36:38 -05:00
|
|
|
<.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)
|
|
|
|
}
|
|
|
|
data-qa="delete"
|
|
|
|
>
|
2022-02-05 01:59:40 -05:00
|
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-01-31 21:56:02 -05:00
|
|
|
</div>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<hr class="mb-4 hr" />
|
2022-02-13 21:14:48 -05:00
|
|
|
|
|
|
|
<%= if @container.tags |> Enum.empty?() do %>
|
|
|
|
<div class="flex flex-row justify-center items-center space-x-4">
|
2022-02-17 22:29:01 -05:00
|
|
|
<h2 class="title text-lg text-primary-600">
|
2022-02-15 23:52:44 -05:00
|
|
|
<%= gettext("No tags for this container") %>
|
|
|
|
<%= display_emoji("😔") %>
|
2022-02-13 21:14:48 -05:00
|
|
|
</h2>
|
|
|
|
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
|
|
|
class="btn btn-primary"
|
|
|
|
>
|
|
|
|
<%= dgettext("actions", "Why not add one?") %>
|
|
|
|
</.link>
|
2022-02-13 21:14:48 -05:00
|
|
|
</div>
|
|
|
|
<% else %>
|
2022-02-18 22:56:46 -05:00
|
|
|
<div class="flex flex-wrap justify-center items-center">
|
|
|
|
<%= for tag <- @container.tags do %>
|
|
|
|
<.simple_tag_card tag={tag} />
|
|
|
|
<% end %>
|
2022-02-13 21:14:48 -05:00
|
|
|
|
2022-02-18 22:56:46 -05:00
|
|
|
<div class="mx-4 my-2">
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
|
|
|
class="text-primary-600 link"
|
|
|
|
>
|
2022-02-18 22:56:46 -05:00
|
|
|
<i class="fa-fw fa-lg fas fa-tags"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-02-18 22:56:46 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-02-13 21:14:48 -05:00
|
|
|
<% end %>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<hr class="mb-4 hr" />
|
2022-01-31 21:56:02 -05:00
|
|
|
|
2022-11-12 13:52:24 -05:00
|
|
|
<div class="flex justify-center items-center space-x-4">
|
2022-11-07 00:37:53 -05:00
|
|
|
<.toggle_button action="toggle_show_used" value={@show_used}>
|
|
|
|
<span class="title text-lg text-primary-600">
|
2022-11-12 13:52:24 -05:00
|
|
|
<%= 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") %>
|
2022-11-07 00:37:53 -05:00
|
|
|
</span>
|
|
|
|
</.toggle_button>
|
|
|
|
</div>
|
|
|
|
|
2022-11-12 13:52:24 -05:00
|
|
|
<div class="w-full p-4">
|
2022-11-07 00:37:53 -05:00
|
|
|
<%= if @ammo_groups |> Enum.empty?() do %>
|
2022-11-19 12:01:28 -05:00
|
|
|
<h2 class="mx-4 title text-lg text-primary-600 text-center">
|
2022-07-01 00:23:04 -04:00
|
|
|
<%= gettext("No ammo in this container") %>
|
2022-02-23 20:35:18 -05:00
|
|
|
</h2>
|
2022-02-05 01:59:40 -05:00
|
|
|
<% else %>
|
2022-11-12 13:52:24 -05:00
|
|
|
<%= 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-center">
|
|
|
|
<%= for ammo_group <- @ammo_groups do %>
|
|
|
|
<.ammo_group_card ammo_group={ammo_group} />
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<% end %>
|
2022-02-23 20:35:18 -05:00
|
|
|
</div>
|
2022-01-31 21:56:02 -05:00
|
|
|
</div>
|
2022-02-13 21:14:48 -05:00
|
|
|
|
|
|
|
<%= if @live_action in [:edit] do %>
|
2022-02-14 01:26:51 -05:00
|
|
|
<.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>
|
2022-02-13 21:14:48 -05:00
|
|
|
<% end %>
|
|
|
|
|
2022-02-18 22:56:46 -05:00
|
|
|
<%= if @live_action == :edit_tags do %>
|
2022-02-14 01:26:51 -05:00
|
|
|
<.modal return_to={Routes.container_show_path(Endpoint, :show, @container)}>
|
|
|
|
<.live_component
|
2022-02-18 22:56:46 -05:00
|
|
|
module={CanneryWeb.ContainerLive.EditTagsComponent}
|
2022-02-14 01:26:51 -05:00
|
|
|
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>
|
2022-02-13 21:14:48 -05:00
|
|
|
<% end %>
|