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

68 lines
2.0 KiB
Plaintext
Raw Normal View History

2022-02-15 23:52:44 -05:00
<div class="flex flex-col space-y-8 justify-center items-center">
2022-01-31 23:03:13 -05:00
<h1 class="title text-2xl title-primary-500">
2022-07-01 00:20:50 -04:00
<%= gettext("Catalog") %>
2022-01-31 23:03:13 -05:00
</h1>
<%= if @rows |> Enum.empty?() do %>
2022-02-17 22:29:01 -05:00
<h2 class="title text-xl text-primary-600">
2022-11-19 15:04:56 -05:00
<%= gettext("No Ammo types") %>
2022-02-15 23:52:44 -05:00
<%= display_emoji("😔") %>
2022-02-01 00:12:09 -05:00
</h2>
2022-01-31 23:03:13 -05:00
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "Add your first type!") %>
</.link>
2022-02-01 00:12:09 -05:00
<% else %>
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "New Ammo type") %>
</.link>
2022-01-31 23:03:13 -05:00
2022-12-03 19:30:52 -05:00
<div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
<.form
:let={f}
for={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="ammo_type_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search catalog")
) %>
</.form>
<.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}
2022-03-04 22:27:09 -05:00
id="ammo_types_index_table"
action={@live_action}
columns={@columns}
rows={@rows}
/>
2022-02-01 00:12:09 -05:00
<% end %>
2022-01-31 23:03:13 -05:00
</div>
2022-11-10 19:10:28 -05:00
<%= if @live_action in [:new, :edit, :clone] do %>
2022-02-14 01:26:51 -05:00
<.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>
2022-01-31 23:03:13 -05:00
<% end %>