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

83 lines
2.6 KiB
Plaintext
Raw Normal View History

2022-01-31 21:42:24 -05:00
<div class="flex flex-col space-y-8 justify-center items-center">
<h1 class="title text-2xl title-primary-500">
2022-02-15 17:33:07 -05:00
<%= gettext("Containers") %>
2022-01-31 21:42:24 -05:00
</h1>
<%= if @containers |> Enum.empty?() do %>
2022-02-17 22:29:01 -05:00
<h2 class="title text-xl text-primary-600">
2022-02-15 23:52:44 -05:00
<%= gettext("No containers") %>
<%= display_emoji("😔") %>
2022-02-01 00:11:37 -05:00
</h2>
2022-01-31 21:42:24 -05:00
2022-02-09 00:49:47 -05:00
<%= live_patch(dgettext("actions", "Add your first container!"),
2022-02-17 22:31:37 -05:00
to: Routes.container_index_path(Endpoint, :new),
2022-02-01 01:08:18 -05:00
class: "btn btn-primary"
) %>
2022-01-31 21:42:24 -05:00
<% else %>
2022-02-09 00:49:47 -05:00
<%= live_patch(dgettext("actions", "New Container"),
2022-02-17 22:31:37 -05:00
to: Routes.container_index_path(Endpoint, :new),
2022-02-09 00:49:47 -05:00
class: "btn btn-primary"
) %>
2022-01-31 21:42:24 -05:00
<% end %>
2022-02-15 23:52:44 -05:00
<div class="flex flex-row flex-wrap justify-center items-center">
2022-01-31 21:42:24 -05:00
<%= for container <- @containers do %>
2022-02-05 01:59:40 -05:00
<.container_card container={container}>
2022-02-18 22:56:46 -05:00
<:tag_actions>
<div class="mx-4 my-2">
<%= live_patch to: Routes.container_index_path(Endpoint, :edit_tags, container),
class: "text-primary-600 link" do %>
<i class="fa-fw fa-lg fas fa-tags"></i>
<% end %>
</div>
</:tag_actions>
2022-02-17 22:31:37 -05:00
<%= live_patch to: Routes.container_index_path(Endpoint, :edit, container),
2022-02-17 22:29:01 -05:00
class: "text-primary-600 link",
2022-02-16 22:39:53 -05:00
data: [qa: "edit-#{container.id}"] do %>
2022-02-05 01:59:40 -05:00
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
<%= link to: "#",
2022-02-17 22:29:01 -05:00
class: "text-primary-600 link",
2022-02-05 01:59:40 -05:00
phx_click: "delete",
phx_value_id: container.id,
2022-02-09 00:49:47 -05:00
data: [
confirm:
2022-02-16 22:39:53 -05:00
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name),
qa: "delete-#{container.id}"
2022-02-09 00:49:47 -05:00
] do %>
2022-02-05 01:59:40 -05:00
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</.container_card>
2022-01-31 21:42:24 -05:00
<% end %>
</div>
</div>
<%= if @live_action in [:new, :edit] do %>
2022-02-17 22:31:37 -05:00
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
2022-02-14 01:26:51 -05:00
<.live_component
module={CanneryWeb.ContainerLive.FormComponent}
id={@container.id || :new}
title={@page_title}
action={@live_action}
container={@container}
2022-02-17 22:31:37 -05:00
return_to={Routes.container_index_path(Endpoint, :index)}
2022-02-14 01:26:51 -05:00
current_user={@current_user}
/>
</.modal>
2022-01-31 21:42:24 -05:00
<% end %>
2022-02-18 22:56:46 -05:00
<%= if @live_action == :edit_tags do %>
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.ContainerLive.EditTagsComponent}
id={@container.id}
title={@page_title}
action={@live_action}
container={@container}
current_user={@current_user}
/>
</.modal>
<% end %>