add selectable ammo types
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -18,22 +18,15 @@
|
||||
<%= @container.location %>
|
||||
</span>
|
||||
|
||||
<%= unless @ammo_groups |> Enum.empty?() do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Packs:") %>
|
||||
<%= @ammo_groups |> Enum.reject(fn %{count: count} -> count in [0, nil] end) |> Enum.count() %>
|
||||
</span>
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Packs:") %>
|
||||
<%= @ammo_groups_count %>
|
||||
</span>
|
||||
|
||||
<span :if={@show_used} class="rounded-lg title text-lg">
|
||||
<%= gettext("Total packs:") %>
|
||||
<%= Enum.count(@ammo_groups) %>
|
||||
</span>
|
||||
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Rounds:") %>
|
||||
<%= @round_count %>
|
||||
</span>
|
||||
<% end %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Rounds:") %>
|
||||
<%= @round_count %>
|
||||
</span>
|
||||
|
||||
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
||||
<.link
|
||||
@ -93,11 +86,29 @@
|
||||
<hr class="mb-4 hr" />
|
||||
|
||||
<div class="flex justify-center items-center space-x-4">
|
||||
<.toggle_button action="toggle_show_used" value={@show_used}>
|
||||
<span class="title text-lg text-primary-600">
|
||||
<%= gettext("Show used") %>
|
||||
</span>
|
||||
</.toggle_button>
|
||||
<.form
|
||||
:let={f}
|
||||
for={%{}}
|
||||
as={:ammo_type}
|
||||
phx-change="change_type"
|
||||
phx-submit="change_type"
|
||||
class="flex items-center"
|
||||
>
|
||||
<%= label(f, :type, gettext("Type"), class: "title text-primary-600 text-lg text-center") %>
|
||||
|
||||
<%= select(
|
||||
f,
|
||||
:type,
|
||||
[
|
||||
{gettext("All"), :all},
|
||||
{gettext("Rifle"), :rifle},
|
||||
{gettext("Shotgun"), :shotgun},
|
||||
{gettext("Pistol"), :pistol}
|
||||
],
|
||||
class: "mx-2 my-1 min-w-md input input-primary",
|
||||
value: @type
|
||||
) %>
|
||||
</.form>
|
||||
|
||||
<.toggle_button action="toggle_table" value={@view_table}>
|
||||
<span class="title text-lg text-primary-600">
|
||||
@ -118,7 +129,7 @@
|
||||
id="ammo-type-show-table"
|
||||
ammo_groups={@ammo_groups}
|
||||
current_user={@current_user}
|
||||
show_used={@show_used}
|
||||
show_used={false}
|
||||
>
|
||||
<:ammo_type :let={%{name: ammo_type_name} = ammo_type}>
|
||||
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="link">
|
||||
|
Reference in New Issue
Block a user