diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0aaa5b1a..3bf1be64 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
# v0.4.0
+- Make tables sortable
- Add link to changelog from version number
- Fix some elements flashing with black background
- Fix bug with moving ammo group to new container
diff --git a/lib/cannery_web/components/move_ammo_group_component.ex b/lib/cannery_web/components/move_ammo_group_component.ex
index c9fbc7b8..8a8c3de6 100644
--- a/lib/cannery_web/components/move_ammo_group_component.ex
+++ b/lib/cannery_web/components/move_ammo_group_component.ex
@@ -106,33 +106,30 @@ defmodule CanneryWeb.Components.MoveAmmoGroupComponent do
defp get_rows_for_containers(containers, assigns, columns) do
containers
|> Enum.map(fn container ->
- assigns = assigns |> Map.put(:container, container)
-
columns
- |> Enum.into(%{}, fn %{key: key} ->
- value =
- case key do
- "actions" ->
- ~H"""
-
-
- <%= dgettext("actions", "Select") %>
-
-
- """
-
- key ->
- container |> Map.get(key |> String.to_existing_atom())
- end
-
- {key, value}
- end)
+ |> Enum.into(%{}, fn %{key: key} -> {key, get_row_value_by_key(key, container, assigns)} end)
end)
end
+
+ @spec get_row_value_by_key(String.t(), Container.t(), map()) :: any()
+ defp get_row_value_by_key("actions", container, assigns) do
+ assigns = assigns |> Map.put(:container, container)
+
+ ~H"""
+
+
+ <%= dgettext("actions", "Select") %>
+
+
+ """
+ end
+
+ defp get_row_value_by_key(key, container, _assigns),
+ do: container |> Map.get(key |> String.to_existing_atom())
end
diff --git a/lib/cannery_web/components/table_component.html.heex b/lib/cannery_web/components/table_component.html.heex
index e69dc3c6..dadf158f 100644
--- a/lib/cannery_web/components/table_component.html.heex
+++ b/lib/cannery_web/components/table_component.html.heex
@@ -5,15 +5,19 @@
<%= for %{key: key, label: label} = column <- @columns do %>
<%= if column |> Map.get(:sortable, true) do %>
-
+ phx-target={@myself}
+ >
<%= label %>
<%= if @last_sort_key == key do %>
<%= case @sort_mode do %>
- <% :asc -> %>
- <% :desc -> %>
+ <% :asc -> %>
+
+ <% :desc -> %>
+
<% end %>
<% else %>
@@ -34,8 +38,10 @@
<%= for %{key: key} = value <- @columns do %>
<%= case values |> Map.get(key) do %>
- <%= {_custom_sort_value, value} -> %> <%= value %>
- <% value -> %> <%= value %>
+ <% {_custom_sort_value, value} -> %>
+ <%= value %>
+ <% value -> %>
+ <%= value %>
<% end %>
<% end %>
diff --git a/lib/cannery_web/live/ammo_group_live/index.ex b/lib/cannery_web/live/ammo_group_live/index.ex
index 96e19d80..c217dcd1 100644
--- a/lib/cannery_web/live/ammo_group_live/index.ex
+++ b/lib/cannery_web/live/ammo_group_live/index.ex
@@ -88,98 +88,99 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
rows =
ammo_groups
- |> Enum.map(fn ammo_group ->
- assigns = %{ammo_group: ammo_group}
-
- columns
- |> Enum.into(%{}, fn %{key: key} ->
- value =
- case key do
- "ammo_type" ->
- {ammo_group.ammo_type.name,
- live_patch(ammo_group.ammo_type.name,
- to: Routes.ammo_type_show_path(Endpoint, :show, ammo_group.ammo_type),
- class: "link"
- )}
-
- "price_paid" ->
- if ammo_group.price_paid do
- gettext("$%{amount}",
- amount: ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)
- )
- else
- {"a", nil}
- end
-
- "remaining" ->
- "#{ammo_group |> Ammo.get_percentage_remaining()}%"
-
- "range" ->
- {ammo_group.staged,
- ~H"""
-
- <%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
-
-
- <%= live_patch(dgettext("actions", "Record shots"),
- to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group),
- class: "btn btn-primary"
- ) %>
- """}
-
- "container" ->
- if ammo_group.container do
- {ammo_group.container.name,
- live_patch(ammo_group.container.name,
- to: Routes.ammo_group_index_path(Endpoint, :move, ammo_group),
- class: "btn btn-primary"
- )}
- else
- {nil, nil}
- end
-
- "actions" ->
- ~H"""
-
- <%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, ammo_group),
- class: "text-primary-600 link",
- data: [qa: "view-#{ammo_group.id}"] do %>
-
- <% end %>
-
- <%= live_patch to: Routes.ammo_group_index_path(Endpoint, :edit, ammo_group),
- class: "text-primary-600 link",
- data: [qa: "edit-#{ammo_group.id}"] do %>
-
- <% end %>
-
- <%= link to: "#",
- class: "text-primary-600 link",
- phx_click: "delete",
- phx_value_id: ammo_group.id,
- data: [
- confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
- qa: "delete-#{ammo_group.id}"
- ] do %>
-
- <% end %>
-
- """
-
- _ ->
- ammo_group |> Map.get(key |> String.to_existing_atom())
- end
-
- {key, value}
- end)
- end)
+ |> Enum.map(fn ammo_group -> ammo_group |> get_row_data_for_ammo_group(columns) end)
socket
|> assign(ammo_groups: ammo_groups, containers: containers, columns: columns, rows: rows)
end
+
+ @spec get_row_data_for_ammo_group(AmmoGroup.t(), [map()]) :: [map()]
+ defp get_row_data_for_ammo_group(ammo_group, columns) do
+ ammo_group = ammo_group |> Repo.preload([:ammo_type, :container])
+
+ columns
+ |> Enum.into(%{}, fn %{key: key} -> {key, get_value_for_key(key, ammo_group)} end)
+ end
+
+ @spec get_value_for_key(String.t(), AmmoGroup.t()) :: any()
+ defp get_value_for_key("ammo_type", %{ammo_type: ammo_type}) do
+ {ammo_type.name,
+ live_patch(ammo_type.name,
+ to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type),
+ class: "link"
+ )}
+ end
+
+ defp get_value_for_key("price_paid", %{price_paid: nil}), do: {"a", nil}
+
+ defp get_value_for_key("price_paid", %{price_paid: price_paid}),
+ do: gettext("$%{amount}", amount: price_paid |> :erlang.float_to_binary(decimals: 2))
+
+ defp get_value_for_key("range", %{staged: staged} = ammo_group) do
+ assigns = %{ammo_group: ammo_group}
+
+ {staged,
+ ~H"""
+
+ <%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
+
+
+ <%= live_patch(dgettext("actions", "Record shots"),
+ to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group),
+ class: "btn btn-primary"
+ ) %>
+ """}
+ end
+
+ defp get_value_for_key("remaining", ammo_group),
+ do: "#{ammo_group |> Ammo.get_percentage_remaining()}%"
+
+ defp get_value_for_key("actions", ammo_group) do
+ assigns = %{ammo_group: ammo_group}
+
+ ~H"""
+
+ <%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, ammo_group),
+ class: "text-primary-600 link",
+ data: [qa: "view-#{ammo_group.id}"] do %>
+
+ <% end %>
+
+ <%= live_patch to: Routes.ammo_group_index_path(Endpoint, :edit, ammo_group),
+ class: "text-primary-600 link",
+ data: [qa: "edit-#{ammo_group.id}"] do %>
+
+ <% end %>
+
+ <%= link to: "#",
+ class: "text-primary-600 link",
+ phx_click: "delete",
+ phx_value_id: ammo_group.id,
+ data: [
+ confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
+ qa: "delete-#{ammo_group.id}"
+ ] do %>
+
+ <% end %>
+
+ """
+ end
+
+ defp get_value_for_key("container", %{container: nil}), do: {nil, nil}
+
+ defp get_value_for_key("container", %{container: %{name: container_name}} = ammo_group) do
+ {container_name,
+ live_patch(container_name,
+ to: Routes.ammo_group_index_path(Endpoint, :move, ammo_group),
+ class: "btn btn-primary"
+ )}
+ end
+
+ defp get_value_for_key(key, ammo_group),
+ do: ammo_group |> Map.get(key |> String.to_existing_atom())
end
diff --git a/lib/cannery_web/live/ammo_group_live/index.html.heex b/lib/cannery_web/live/ammo_group_live/index.html.heex
index 1daea38d..d10ced30 100644
--- a/lib/cannery_web/live/ammo_group_live/index.html.heex
+++ b/lib/cannery_web/live/ammo_group_live/index.html.heex
@@ -47,7 +47,7 @@
<.live_component
module={CanneryWeb.Components.TableComponent}
- id="ammo_groups_index"
+ id="ammo_groups_index_table"
action={@live_action}
columns={@columns}
rows={@rows}
@@ -93,5 +93,6 @@
current_user={@current_user}
/>
- <% true -> %> <%= nil %>
+ <% true -> %>
+ <%= nil %>
<% end %>
diff --git a/lib/cannery_web/live/ammo_group_live/show.html.heex b/lib/cannery_web/live/ammo_group_live/show.html.heex
index f70b5296..b7a656a2 100644
--- a/lib/cannery_web/live/ammo_group_live/show.html.heex
+++ b/lib/cannery_web/live/ammo_group_live/show.html.heex
@@ -113,7 +113,7 @@
<.live_component
module={CanneryWeb.Components.TableComponent}
- id="shot_groups_table"
+ id="ammo_group_shot_groups_table"
columns={@columns}
rows={@rows}
/>
diff --git a/lib/cannery_web/live/ammo_type_live/index.html.heex b/lib/cannery_web/live/ammo_type_live/index.html.heex
index 4f813f41..90243e90 100644
--- a/lib/cannery_web/live/ammo_type_live/index.html.heex
+++ b/lib/cannery_web/live/ammo_type_live/index.html.heex
@@ -21,7 +21,7 @@
<.live_component
module={CanneryWeb.Components.TableComponent}
- id="ammo_types_index"
+ id="ammo_types_index_table"
action={@live_action}
columns={@columns}
rows={@rows}
diff --git a/lib/cannery_web/live/range_live/index.ex b/lib/cannery_web/live/range_live/index.ex
index 27a0e735..8951dfcc 100644
--- a/lib/cannery_web/live/range_live/index.ex
+++ b/lib/cannery_web/live/range_live/index.ex
@@ -88,54 +88,58 @@ defmodule CanneryWeb.RangeLive.Index do
rows =
shot_groups
- |> Enum.map(fn %{date: date} = shot_group ->
- assigns = %{shot_group: shot_group}
-
- columns
- |> Enum.into(%{}, fn %{key: key} ->
- value =
- case key do
- "name" ->
- {shot_group.ammo_group.ammo_type.name,
- live_patch(shot_group.ammo_group.ammo_type.name,
- to: Routes.ammo_group_show_path(Endpoint, :show, shot_group.ammo_group),
- class: "link"
- )}
-
- "date" ->
- date |> display_date()
-
- "actions" ->
- ~H"""
-
- <%= live_patch to: Routes.range_index_path(Endpoint, :edit, shot_group),
- class: "text-primary-600 link",
- data: [qa: "edit-#{shot_group.id}"] do %>
-
- <% end %>
-
- <%= link to: "#",
- class: "text-primary-600 link",
- phx_click: "delete",
- phx_value_id: shot_group.id,
- data: [
- confirm: dgettext("prompts", "Are you sure you want to delete this shot record?"),
- qa: "delete-#{shot_group.id}"
- ] do %>
-
- <% end %>
-
- """
-
- value ->
- shot_group |> Map.get(key |> String.to_existing_atom())
- end
-
- {key, value}
- end)
- end)
+ |> Enum.map(fn shot_group -> shot_group |> get_row_data_for_shot_group(columns) end)
socket
|> assign(ammo_groups: ammo_groups, columns: columns, rows: rows, shot_groups: shot_groups)
end
+
+ @spec get_row_data_for_shot_group(ShotGroup.t(), [map()]) :: [map()]
+ defp get_row_data_for_shot_group(%{date: date} = shot_group, columns) do
+ shot_group = shot_group |> Repo.preload(ammo_group: :ammo_type)
+ assigns = %{shot_group: shot_group}
+
+ columns
+ |> Enum.into(%{}, fn %{key: key} ->
+ value =
+ case key do
+ "name" ->
+ {shot_group.ammo_group.ammo_type.name,
+ live_patch(shot_group.ammo_group.ammo_type.name,
+ to: Routes.ammo_group_show_path(Endpoint, :show, shot_group.ammo_group),
+ class: "link"
+ )}
+
+ "date" ->
+ date |> display_date()
+
+ "actions" ->
+ ~H"""
+
+ <%= live_patch to: Routes.range_index_path(Endpoint, :edit, shot_group),
+ class: "text-primary-600 link",
+ data: [qa: "edit-#{shot_group.id}"] do %>
+
+ <% end %>
+
+ <%= link to: "#",
+ class: "text-primary-600 link",
+ phx_click: "delete",
+ phx_value_id: shot_group.id,
+ data: [
+ confirm: dgettext("prompts", "Are you sure you want to delete this shot record?"),
+ qa: "delete-#{shot_group.id}"
+ ] do %>
+
+ <% end %>
+
+ """
+
+ key ->
+ shot_group |> Map.get(key |> String.to_existing_atom())
+ end
+
+ {key, value}
+ end)
+ end
end
diff --git a/lib/cannery_web/live/range_live/index.html.heex b/lib/cannery_web/live/range_live/index.html.heex
index 538dd412..40d881d6 100644
--- a/lib/cannery_web/live/range_live/index.html.heex
+++ b/lib/cannery_web/live/range_live/index.html.heex
@@ -55,7 +55,7 @@
<.live_component
module={CanneryWeb.Components.TableComponent}
- id="shot_groups_table"
+ id="shot_groups_index_table"
columns={@columns}
rows={@rows}
/>
diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot
index 4c3eebef..4aa48ce0 100644
--- a/priv/gettext/actions.pot
+++ b/priv/gettext/actions.pot
@@ -160,7 +160,7 @@ msgid "Why not get some ready to shoot?"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:111
+#: lib/cannery_web/live/ammo_group_live/index.ex:133
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:36
msgid "Record shots"
@@ -172,7 +172,7 @@ msgid "Ammo Details"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:12
+#: lib/cannery_web/components/move_ammo_group_component.ex:89
msgid "Add another container!"
msgstr ""
@@ -182,7 +182,7 @@ msgid "Move containers"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:60
+#: lib/cannery_web/components/move_ammo_group_component.ex:127
msgid "Select"
msgstr ""
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index 98e1b6bd..446bccb4 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -33,13 +33,13 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:52
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3
-#: lib/cannery_web/live/range_live/index.html.heex:61
+#: lib/cannery_web/live/range_live/index.ex:82
msgid "Ammo"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:53
+#: lib/cannery_web/live/ammo_group_live/index.ex:80
msgid "Ammo type"
msgstr ""
@@ -55,7 +55,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:140
-#: lib/cannery_web/live/ammo_type_live/index.ex:67
+#: lib/cannery_web/live/ammo_type_live/index.ex:71
#: lib/cannery_web/live/ammo_type_live/show.html.heex:55
msgid "Blank"
msgstr ""
@@ -101,9 +101,9 @@ msgid "Case material"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:22
+#: lib/cannery_web/components/move_ammo_group_component.ex:67
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:48
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:68
+#: lib/cannery_web/live/ammo_group_live/index.ex:85
msgid "Container"
msgstr ""
@@ -116,14 +116,14 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:144
-#: lib/cannery_web/live/ammo_type_live/index.ex:68
+#: lib/cannery_web/live/ammo_type_live/index.ex:72
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
msgid "Corrosive"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:81
msgid "Count"
msgstr ""
@@ -194,14 +194,14 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:103
-#: lib/cannery_web/live/ammo_type_live/index.ex:61
+#: lib/cannery_web/live/ammo_type_live/index.ex:65
#: lib/cannery_web/live/ammo_type_live/show.html.heex:49
msgid "Grains"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:136
-#: lib/cannery_web/live/ammo_type_live/index.ex:66
+#: lib/cannery_web/live/ammo_type_live/index.ex:70
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
msgid "Incendiary"
msgstr ""
@@ -234,7 +234,7 @@ msgid "Keep me logged in for 60 days"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:30
+#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
msgid "Location"
msgstr ""
@@ -257,7 +257,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:148
-#: lib/cannery_web/live/ammo_type_live/index.ex:69
+#: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.html.heex:57
msgid "Manufacturer"
msgstr ""
@@ -340,9 +340,9 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:122
+#: lib/cannery_web/live/ammo_group_live/show.ex:90
#: lib/cannery_web/live/range_live/form_component.html.heex:29
-#: lib/cannery_web/live/range_live/index.html.heex:67
+#: lib/cannery_web/live/range_live/index.ex:84
msgid "Notes"
msgstr ""
@@ -359,14 +359,14 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:111
-#: lib/cannery_web/live/ammo_type_live/index.ex:62
+#: lib/cannery_web/live/ammo_type_live/index.ex:66
#: lib/cannery_web/live/ammo_type_live/show.html.heex:50
msgid "Pressure"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:59
+#: lib/cannery_web/live/ammo_group_live/index.ex:82
msgid "Price paid"
msgstr ""
@@ -377,7 +377,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:118
-#: lib/cannery_web/live/ammo_type_live/index.ex:63
+#: lib/cannery_web/live/ammo_type_live/index.ex:67
#: lib/cannery_web/live/ammo_type_live/show.html.heex:51
msgid "Primer type"
msgstr ""
@@ -462,13 +462,13 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:132
-#: lib/cannery_web/live/ammo_type_live/index.ex:65
+#: lib/cannery_web/live/ammo_type_live/index.ex:69
#: lib/cannery_web/live/ammo_type_live/show.html.heex:53
msgid "Tracer"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:26
+#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
msgid "Type"
msgstr ""
@@ -511,7 +511,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:64
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:65
+#: lib/cannery_web/live/ammo_group_live/index.ex:84
msgid "Range"
msgstr ""
@@ -521,8 +521,8 @@ msgid "Range day"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:125
-#: lib/cannery_web/live/range_live/index.html.heex:70
+#: lib/cannery_web/live/ammo_group_live/show.ex:91
+#: lib/cannery_web/live/range_live/index.ex:85
msgid "Date"
msgstr ""
@@ -592,8 +592,8 @@ msgid "Rounds left"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:119
-#: lib/cannery_web/live/range_live/index.html.heex:64
+#: lib/cannery_web/live/ammo_group_live/show.ex:89
+#: lib/cannery_web/live/range_live/index.ex:83
msgid "Rounds shot"
msgstr ""
@@ -609,12 +609,12 @@ msgid "Move Ammo group"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:3
+#: lib/cannery_web/components/move_ammo_group_component.ex:80
msgid "Move ammo"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:8
+#: lib/cannery_web/components/move_ammo_group_component.ex:85
msgid "No other containers"
msgstr ""
@@ -625,7 +625,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/ammo_group_card.ex:43
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:117
#: lib/cannery_web/live/ammo_group_live/show.html.heex:32
#: lib/cannery_web/live/ammo_group_live/show.html.heex:39
#: lib/cannery_web/live/ammo_type_live/show.html.heex:98
@@ -653,7 +653,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:93
-#: lib/cannery_web/live/ammo_type_live/index.ex:60
+#: lib/cannery_web/live/ammo_type_live/index.ex:61
#: lib/cannery_web/live/ammo_type_live/show.html.heex:48
msgid "Powder grains per charge"
msgstr ""
@@ -667,7 +667,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:152
-#: lib/cannery_web/live/ammo_type_live/index.ex:70
+#: lib/cannery_web/live/ammo_type_live/index.ex:74
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
msgid "UPC"
msgstr ""
@@ -689,18 +689,18 @@ msgid "New password"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:108
+#: lib/cannery_web/live/ammo_group_live/index.ex:130
msgid "Stage"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:108
+#: lib/cannery_web/live/ammo_group_live/index.ex:130
msgid "Unstage"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:125
-#: lib/cannery_web/live/ammo_type_live/index.ex:64
+#: lib/cannery_web/live/ammo_type_live/index.ex:68
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
msgid "Firing type"
msgstr ""
@@ -743,7 +743,7 @@ msgid "No cost information"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:62
+#: lib/cannery_web/live/ammo_group_live/index.ex:83
msgid "% left"
msgstr ""
@@ -778,7 +778,7 @@ msgid "Current # of rounds:"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_type_live/index.html.heex:32
+#: lib/cannery_web/live/ammo_type_live/index.ex:86
msgid "Total # of rounds"
msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/actions.po b/priv/gettext/en/LC_MESSAGES/actions.po
index 4250e0ef..051b16f2 100644
--- a/priv/gettext/en/LC_MESSAGES/actions.po
+++ b/priv/gettext/en/LC_MESSAGES/actions.po
@@ -161,7 +161,7 @@ msgid "Why not get some ready to shoot?"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:111
+#: lib/cannery_web/live/ammo_group_live/index.ex:133
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:36
msgid "Record shots"
@@ -173,7 +173,7 @@ msgid "Ammo Details"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:12
+#: lib/cannery_web/components/move_ammo_group_component.ex:89
msgid "Add another container!"
msgstr ""
@@ -183,7 +183,7 @@ msgid "Move containers"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:60
+#: lib/cannery_web/components/move_ammo_group_component.ex:127
msgid "Select"
msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index 5d6d0c75..1a61d3a4 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -34,13 +34,13 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:52
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3
-#: lib/cannery_web/live/range_live/index.html.heex:61
+#: lib/cannery_web/live/range_live/index.ex:82
msgid "Ammo"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:53
+#: lib/cannery_web/live/ammo_group_live/index.ex:80
msgid "Ammo type"
msgstr ""
@@ -56,7 +56,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:140
-#: lib/cannery_web/live/ammo_type_live/index.ex:67
+#: lib/cannery_web/live/ammo_type_live/index.ex:71
#: lib/cannery_web/live/ammo_type_live/show.html.heex:55
msgid "Blank"
msgstr ""
@@ -102,9 +102,9 @@ msgid "Case material"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:22
+#: lib/cannery_web/components/move_ammo_group_component.ex:67
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:48
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:68
+#: lib/cannery_web/live/ammo_group_live/index.ex:85
msgid "Container"
msgstr ""
@@ -117,14 +117,14 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:144
-#: lib/cannery_web/live/ammo_type_live/index.ex:68
+#: lib/cannery_web/live/ammo_type_live/index.ex:72
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
msgid "Corrosive"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:81
msgid "Count"
msgstr ""
@@ -195,14 +195,14 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:103
-#: lib/cannery_web/live/ammo_type_live/index.ex:61
+#: lib/cannery_web/live/ammo_type_live/index.ex:65
#: lib/cannery_web/live/ammo_type_live/show.html.heex:49
msgid "Grains"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:136
-#: lib/cannery_web/live/ammo_type_live/index.ex:66
+#: lib/cannery_web/live/ammo_type_live/index.ex:70
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
msgid "Incendiary"
msgstr ""
@@ -235,7 +235,7 @@ msgid "Keep me logged in for 60 days"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:30
+#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
msgid "Location"
msgstr ""
@@ -258,7 +258,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:148
-#: lib/cannery_web/live/ammo_type_live/index.ex:69
+#: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.html.heex:57
msgid "Manufacturer"
msgstr ""
@@ -341,9 +341,9 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:122
+#: lib/cannery_web/live/ammo_group_live/show.ex:90
#: lib/cannery_web/live/range_live/form_component.html.heex:29
-#: lib/cannery_web/live/range_live/index.html.heex:67
+#: lib/cannery_web/live/range_live/index.ex:84
msgid "Notes"
msgstr ""
@@ -360,14 +360,14 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:111
-#: lib/cannery_web/live/ammo_type_live/index.ex:62
+#: lib/cannery_web/live/ammo_type_live/index.ex:66
#: lib/cannery_web/live/ammo_type_live/show.html.heex:50
msgid "Pressure"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:59
+#: lib/cannery_web/live/ammo_group_live/index.ex:82
msgid "Price paid"
msgstr ""
@@ -378,7 +378,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:118
-#: lib/cannery_web/live/ammo_type_live/index.ex:63
+#: lib/cannery_web/live/ammo_type_live/index.ex:67
#: lib/cannery_web/live/ammo_type_live/show.html.heex:51
msgid "Primer type"
msgstr ""
@@ -463,13 +463,13 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:132
-#: lib/cannery_web/live/ammo_type_live/index.ex:65
+#: lib/cannery_web/live/ammo_type_live/index.ex:69
#: lib/cannery_web/live/ammo_type_live/show.html.heex:53
msgid "Tracer"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:26
+#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
msgid "Type"
msgstr ""
@@ -512,7 +512,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:64
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:65
+#: lib/cannery_web/live/ammo_group_live/index.ex:84
msgid "Range"
msgstr ""
@@ -522,8 +522,8 @@ msgid "Range day"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:125
-#: lib/cannery_web/live/range_live/index.html.heex:70
+#: lib/cannery_web/live/ammo_group_live/show.ex:91
+#: lib/cannery_web/live/range_live/index.ex:85
msgid "Date"
msgstr ""
@@ -593,8 +593,8 @@ msgid "Rounds left"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:119
-#: lib/cannery_web/live/range_live/index.html.heex:64
+#: lib/cannery_web/live/ammo_group_live/show.ex:89
+#: lib/cannery_web/live/range_live/index.ex:83
msgid "Rounds shot"
msgstr ""
@@ -610,12 +610,12 @@ msgid "Move Ammo group"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:3
+#: lib/cannery_web/components/move_ammo_group_component.ex:80
msgid "Move ammo"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.html.heex:8
+#: lib/cannery_web/components/move_ammo_group_component.ex:85
msgid "No other containers"
msgstr ""
@@ -626,7 +626,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/ammo_group_card.ex:43
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:117
#: lib/cannery_web/live/ammo_group_live/show.html.heex:32
#: lib/cannery_web/live/ammo_group_live/show.html.heex:39
#: lib/cannery_web/live/ammo_type_live/show.html.heex:98
@@ -654,7 +654,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:93
-#: lib/cannery_web/live/ammo_type_live/index.ex:60
+#: lib/cannery_web/live/ammo_type_live/index.ex:61
#: lib/cannery_web/live/ammo_type_live/show.html.heex:48
msgid "Powder grains per charge"
msgstr ""
@@ -668,7 +668,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:152
-#: lib/cannery_web/live/ammo_type_live/index.ex:70
+#: lib/cannery_web/live/ammo_type_live/index.ex:74
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
msgid "UPC"
msgstr ""
@@ -690,18 +690,18 @@ msgid "New password"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:108
+#: lib/cannery_web/live/ammo_group_live/index.ex:130
msgid "Stage"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:108
+#: lib/cannery_web/live/ammo_group_live/index.ex:130
msgid "Unstage"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:125
-#: lib/cannery_web/live/ammo_type_live/index.ex:64
+#: lib/cannery_web/live/ammo_type_live/index.ex:68
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
msgid "Firing type"
msgstr ""
@@ -744,7 +744,7 @@ msgid "No cost information"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:62
+#: lib/cannery_web/live/ammo_group_live/index.ex:83
msgid "% left"
msgstr ""
@@ -779,7 +779,7 @@ msgid "Current # of rounds:"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_type_live/index.html.heex:32
+#: lib/cannery_web/live/ammo_type_live/index.ex:86
msgid "Total # of rounds"
msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po
index c7293df7..da04c6fe 100644
--- a/priv/gettext/en/LC_MESSAGES/prompts.po
+++ b/priv/gettext/en/LC_MESSAGES/prompts.po
@@ -93,9 +93,9 @@ msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:146
+#: lib/cannery_web/live/ammo_group_live/index.ex:165
#: lib/cannery_web/live/ammo_group_live/show.html.heex:66
-#: lib/cannery_web/live/ammo_type_live/index.html.heex:75
+#: lib/cannery_web/live/ammo_type_live/index.ex:130
msgid "Are you sure you want to delete this ammo?"
msgstr ""
@@ -206,8 +206,8 @@ msgid "Ammo group unstaged succesfully"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:159
-#: lib/cannery_web/live/range_live/index.html.heex:108
+#: lib/cannery_web/live/ammo_group_live/show.ex:132
+#: lib/cannery_web/live/range_live/index.ex:130
msgid "Are you sure you want to delete this shot record?"
msgstr ""
@@ -228,7 +228,7 @@ msgid "%{email} confirmed successfully."
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.ex:47
+#: lib/cannery_web/components/move_ammo_group_component.ex:53
msgid "Ammo moved to %{name} successfully"
msgstr ""
diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot
index 261e5acb..8127efce 100644
--- a/priv/gettext/prompts.pot
+++ b/priv/gettext/prompts.pot
@@ -92,9 +92,9 @@ msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/index.html.heex:146
+#: lib/cannery_web/live/ammo_group_live/index.ex:165
#: lib/cannery_web/live/ammo_group_live/show.html.heex:66
-#: lib/cannery_web/live/ammo_type_live/index.html.heex:75
+#: lib/cannery_web/live/ammo_type_live/index.ex:130
msgid "Are you sure you want to delete this ammo?"
msgstr ""
@@ -205,8 +205,8 @@ msgid "Ammo group unstaged succesfully"
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/live/ammo_group_live/show.html.heex:159
-#: lib/cannery_web/live/range_live/index.html.heex:108
+#: lib/cannery_web/live/ammo_group_live/show.ex:132
+#: lib/cannery_web/live/range_live/index.ex:130
msgid "Are you sure you want to delete this shot record?"
msgstr ""
@@ -227,7 +227,7 @@ msgid "%{email} confirmed successfully."
msgstr ""
#, elixir-autogen, elixir-format
-#: lib/cannery_web/components/move_ammo_group_component.ex:47
+#: lib/cannery_web/components/move_ammo_group_component.ex:53
msgid "Ammo moved to %{name} successfully"
msgstr ""