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

122 lines
3.6 KiB
Plaintext
Raw Normal View History

2022-01-31 21:56:02 -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">
<%= @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 %>
<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.container_show_path(@socket, :edit, @container),
class: "text-primary-500 link" do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
<%= link to: "#",
class: "text-primary-500 link",
2022-02-13 21:14:48 -05:00
phx_click: "delete_container",
2022-02-09 00:49:47 -05:00
data: [
confirm:
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
] do %>
2022-02-05 01:59:40 -05:00
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
2022-01-31 21:56:02 -05:00
</div>
2022-02-13 21:14:48 -05:00
<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-500">
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>
<%= live_patch(dgettext("actions", "Why not add one?"),
to: Routes.container_show_path(Endpoint, :add_tag, @container),
class: "btn btn-primary"
) %>
</div>
<% else %>
<h2 class="mb-4 title text-xl text-primary-500">
<%= gettext("Tags") %>
</h2>
<%= for tag <- @container.tags do %>
<.tag_card tag={tag}>
<%= link to: "#",
class: "text-primary-500 link",
phx_click: "delete_tag",
phx_value_tag_id: tag.id,
data: [
confirm:
dgettext(
"prompts",
"Are you sure you want to remove the %{tag_name} tag from %{container_name}?",
tag_name: tag.name,
container_name: @container.name
)
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</.tag_card>
<% end %>
<% end %>
<hr class="mb-4 hr">
2022-01-31 21:56:02 -05:00
2022-02-05 01:59:40 -05:00
<p>
<%= if @container.ammo_groups |> Enum.empty?() do %>
2022-02-09 00:49:47 -05:00
<%= gettext("No ammo groups in this container") %>
2022-02-05 01:59:40 -05:00
<% else %>
<%= for ammo_group <- @container.ammo_groups do %>
<.ammo_group_card ammo_group={ammo_group} />
<% end %>
<% end %>
</p>
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 %>
<%= if @live_action == :add_tag do %>
2022-02-14 01:26:51 -05:00
<.modal return_to={Routes.container_show_path(Endpoint, :show, @container)}>
<.live_component
module={CanneryWeb.ContainerLive.AddTagComponent}
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 %>