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

52 lines
1.5 KiB
Plaintext

<div class="flex flex-col space-y-8 justify-center items-center">
<h1 class="title text-2xl title-primary-500">
<%= gettext("Catalog") %>
</h1>
<%= if @rows |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No Ammo types") %>
<%= display_emoji("😔") %>
</h2>
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "Add your first type!") %>
</.link>
<% else %>
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "New Ammo type") %>
</.link>
<div class="flex flex-col justify-center items-center">
<.toggle_button action="toggle_show_used" value={@show_used}>
<span class="title text-lg text-primary-600">
<%= gettext("Show used") %>
</span>
</.toggle_button>
</div>
<.live_component
module={CanneryWeb.Components.TableComponent}
id="ammo_types_index_table"
action={@live_action}
columns={@columns}
rows={@rows}
/>
<% end %>
</div>
<%= if @live_action in [:new, :edit, :clone] do %>
<.modal return_to={Routes.ammo_type_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.AmmoTypeLive.FormComponent}
id={@ammo_type.id || :new}
title={@page_title}
action={@live_action}
ammo_type={@ammo_type}
return_to={Routes.ammo_type_index_path(Endpoint, :index)}
current_user={@current_user}
}
/>
</.modal>
<% end %>