<%= gettext("Containers") %>

<%= if @containers |> Enum.empty?() and @search |> is_nil() do %>

<%= gettext("No containers") %> <%= display_emoji("😔") %>

<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary"> <%= dgettext("actions", "Add your first container!") %> <% else %> <.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary"> <%= dgettext("actions", "New Container") %>
<.form :let={f} for={%{}} as={:search} phx-change="search" phx-submit="search" class="grow self-stretch flex flex-col items-stretch" > <%= text_input(f, :search_term, class: "input input-primary", value: @search, role: "search", phx_debounce: 300, placeholder: gettext("Search containers") ) %> <.toggle_button action="toggle_table" value={@view_table}> <%= gettext("View as table") %>
<% end %> <%= if @containers |> Enum.empty?() do %>

<%= gettext("No containers") %> <%= display_emoji("😔") %>

<% else %> <%= if @view_table do %> <.live_component module={CanneryWeb.Components.ContainerTableComponent} id="containers_index_table" action={@live_action} containers={@containers} current_user={@current_user} > <:tag_actions :let={container}>
<.link patch={Routes.container_index_path(Endpoint, :edit_tags, container)} class="text-primary-600 link" aria-label={ dgettext("actions", "Tag %{container_name}", container_name: container.name) } >
<:actions :let={container}> <.link patch={Routes.container_index_path(Endpoint, :edit, container)} class="text-primary-600 link" aria-label={ dgettext("actions", "Edit %{container_name}", container_name: container.name) } > <.link patch={Routes.container_index_path(Endpoint, :clone, container)} class="text-primary-600 link" aria-label={ dgettext("actions", "Clone %{container_name}", container_name: container.name) } > <.link href="#" class="text-primary-600 link" phx-click="delete" phx-value-id={container.id} data-confirm={ dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name) } aria-label={ dgettext("actions", "Delete %{container_name}", container_name: container.name) } > <% else %>
<.container_card :for={container <- @containers} container={container} current_user={@current_user} > <:tag_actions>
<.link patch={Routes.container_index_path(Endpoint, :edit_tags, container)} class="text-primary-600 link" aria-label={ dgettext("actions", "Tag %{container_name}", container_name: container.name) } >
<.link patch={Routes.container_index_path(Endpoint, :edit, container)} class="text-primary-600 link" aria-label={ dgettext("actions", "Edit %{container_name}", container_name: container.name) } > <.link patch={Routes.container_index_path(Endpoint, :clone, container)} class="text-primary-600 link" aria-label={ dgettext("actions", "Clone %{container_name}", container_name: container.name) } > <.link href="#" class="text-primary-600 link" phx-click="delete" phx-value-id={container.id} data-confirm={ dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name) } aria-label={ dgettext("actions", "Delete %{container_name}", container_name: container.name) } >
<% end %> <% end %>
<%= case @live_action do %> <% modifying when modifying in [:new, :edit, :clone] -> %> <.modal return_to={Routes.container_index_path(Endpoint, :index)}> <.live_component module={CanneryWeb.ContainerLive.FormComponent} id={@container.id || :new} title={@page_title} action={@live_action} container={@container} return_to={Routes.container_index_path(Endpoint, :index)} current_user={@current_user} /> <% :edit_tags -> %> <.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_path={Routes.container_index_path(Endpoint, :edit_tags, @container)} current_user={@current_user} /> <% _ -> %> <% end %>