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">
|
|
|
|
Listing Containers
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<%= if @containers |> Enum.empty?() do %>
|
2022-02-01 00:11:37 -05:00
|
|
|
<h2 class="title text-xl text-primary-500">
|
|
|
|
No containers 😔
|
|
|
|
</h2>
|
2022-01-31 21:42:24 -05:00
|
|
|
|
2022-02-01 01:08:18 -05:00
|
|
|
<%= live_patch("Add your first container!",
|
2022-02-01 00:11:37 -05:00
|
|
|
to: Routes.container_index_path(@socket, :new),
|
2022-02-01 01:08:18 -05:00
|
|
|
class: "btn btn-primary"
|
|
|
|
) %>
|
2022-01-31 21:42:24 -05:00
|
|
|
<% else %>
|
|
|
|
<%= live_patch to: Routes.container_index_path(@socket, :new),
|
2022-02-01 01:08:18 -05:00
|
|
|
class: "btn btn-primary" do %>
|
2022-01-31 21:42:24 -05:00
|
|
|
New Container
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div class="flex flex-row flex-wrap">
|
|
|
|
<%= for container <- @containers do %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<.container_card container={container}>
|
|
|
|
<%= live_patch to: Routes.container_index_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",
|
|
|
|
phx_click: "delete",
|
|
|
|
phx_value_id: container.id,
|
|
|
|
data: [confirm: "Are you sure you want to delete #{container.name}?"] do %>
|
|
|
|
<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 %>
|
|
|
|
<%= live_modal(CanneryWeb.ContainerLive.FormComponent,
|
|
|
|
id: @container.id || :new,
|
|
|
|
title: @page_title,
|
|
|
|
action: @live_action,
|
|
|
|
container: @container,
|
|
|
|
return_to: Routes.container_index_path(@socket, :index),
|
|
|
|
current_user: @current_user
|
|
|
|
) %>
|
|
|
|
<% end %>
|