diff --git a/CHANGELOG.md b/CHANGELOG.md
index 253c8839..4a13553f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@
- Forgot to add the logo as the favicon whoops
- Add graph to range page
- Add JSON export of data
+- Add ammo cloning
- Update project dependencies
# v0.5.4
diff --git a/lib/cannery_web/live/ammo_group_live/form_component.ex b/lib/cannery_web/live/ammo_group_live/form_component.ex
index 8133258e..6316049e 100644
--- a/lib/cannery_web/live/ammo_group_live/form_component.ex
+++ b/lib/cannery_web/live/ammo_group_live/form_component.ex
@@ -73,14 +73,14 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
ammo_group_params
) do
changeset_action =
- case action do
- :new -> :insert
- :edit -> :update
+ cond do
+ action in [:new, :clone] -> :insert
+ action == :edit -> :update
end
changeset =
- case action do
- :new ->
+ cond do
+ action in [:new, :clone] ->
ammo_type =
if ammo_group_params |> Map.has_key?("ammo_type_id"),
do: ammo_group_params |> Map.get("ammo_type_id") |> Ammo.get_ammo_type!(user),
@@ -93,7 +93,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
ammo_group |> AmmoGroup.create_changeset(ammo_type, container, user, ammo_group_params)
- :edit ->
+ action == :edit ->
ammo_group |> AmmoGroup.update_changeset(ammo_group_params)
end
@@ -127,9 +127,10 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
defp save_ammo_group(
%{assigns: %{changeset: changeset}} = socket,
- :new,
+ action,
%{"multiplier" => multiplier_str} = ammo_group_params
- ) do
+ )
+ when action in [:new, :clone] do
socket =
case multiplier_str |> Integer.parse() do
{multiplier, _remainder}
diff --git a/lib/cannery_web/live/ammo_group_live/form_component.html.heex b/lib/cannery_web/live/ammo_group_live/form_component.html.heex
index 9ba45327..7d90fa09 100644
--- a/lib/cannery_web/live/ammo_group_live/form_component.html.heex
+++ b/lib/cannery_web/live/ammo_group_live/form_component.html.heex
@@ -51,8 +51,8 @@
) %>
<%= error_tag(f, :container_id, "col-span-3 text-center") %>
- <%= case @action do %>
- <% :new -> %>
+ <%= cond do %>
+ <% @action in [:new, :clone] -> %>
<%= label(f, :multiplier, gettext("Copies"), class: "title text-lg text-primary-600") %>
@@ -69,7 +69,7 @@
) %>
<%= error_tag(f, :multiplier, "col-span-3 text-center") %>
- <% :edit -> %>
+ <% @action == :edit -> %>
<%= submit(dgettext("actions", "Save"),
phx_disable_with: dgettext("prompts", "Saving..."),
class: "mx-auto col-span-3 btn btn-primary"
diff --git a/lib/cannery_web/live/ammo_group_live/index.ex b/lib/cannery_web/live/ammo_group_live/index.ex
index b6f13da8..aac6de53 100644
--- a/lib/cannery_web/live/ammo_group_live/index.ex
+++ b/lib/cannery_web/live/ammo_group_live/index.ex
@@ -39,6 +39,12 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user))
end
+ defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do
+ socket
+ |> assign(:page_title, dgettext("actions", "Add Ammo"))
+ |> assign(:ammo_group, %{Ammo.get_ammo_group!(id, current_user) | id: nil})
+ end
+
defp apply_action(socket, :new, _params) do
socket
|> assign(:page_title, dgettext("actions", "Add Ammo"))
@@ -217,6 +223,14 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
+ <.link
+ patch={Routes.ammo_group_index_path(Endpoint, :clone, @ammo_group)}
+ class="text-primary-600 link"
+ data-qa={"clone-#{@ammo_group.id}"}
+ >
+
+
+
<.link
href="#"
class="text-primary-600 link"
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 8743c39c..ecef0a27 100644
--- a/lib/cannery_web/live/ammo_group_live/index.html.heex
+++ b/lib/cannery_web/live/ammo_group_live/index.html.heex
@@ -61,7 +61,7 @@
<%= cond do %>
- <% @live_action in [:new, :edit] -> %>
+ <% @live_action in [:new, :edit, :clone] -> %>
<.modal return_to={Routes.ammo_group_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.AmmoGroupLive.FormComponent}
diff --git a/lib/cannery_web/router.ex b/lib/cannery_web/router.ex
index 0594d92c..239bc777 100644
--- a/lib/cannery_web/router.ex
+++ b/lib/cannery_web/router.ex
@@ -85,6 +85,7 @@ defmodule CanneryWeb.Router do
live "/ammo", AmmoGroupLive.Index, :index
live "/ammo/new", AmmoGroupLive.Index, :new
live "/ammo/:id/edit", AmmoGroupLive.Index, :edit
+ live "/ammo/:id/clone", AmmoGroupLive.Index, :clone
live "/ammo/:id/add_shot_group", AmmoGroupLive.Index, :add_shot_group
live "/ammo/:id/move", AmmoGroupLive.Index, :move
diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot
index ad771b9d..5c04799b 100644
--- a/priv/gettext/actions.pot
+++ b/priv/gettext/actions.pot
@@ -11,6 +11,7 @@ msgid ""
msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:44
+#: lib/cannery_web/live/ammo_group_live/index.ex:50
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format
msgid "Add Ammo"
@@ -155,7 +156,7 @@ msgstr ""
msgid "Why not get some ready to shoot?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:190
+#: lib/cannery_web/live/ammo_group_live/index.ex:196
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/de/LC_MESSAGES/actions.po b/priv/gettext/de/LC_MESSAGES/actions.po
index 70e34dde..7674b51f 100644
--- a/priv/gettext/de/LC_MESSAGES/actions.po
+++ b/priv/gettext/de/LC_MESSAGES/actions.po
@@ -24,6 +24,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44
+#: lib/cannery_web/live/ammo_group_live/index.ex:50
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format
msgid "Add Ammo"
@@ -168,7 +169,7 @@ msgstr "Munition markieren"
msgid "Why not get some ready to shoot?"
msgstr "Warum nicht einige für den Schießstand auswählen?"
-#: lib/cannery_web/live/ammo_group_live/index.ex:190
+#: lib/cannery_web/live/ammo_group_live/index.ex:196
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po
index 210917a9..c1aa625b 100644
--- a/priv/gettext/de/LC_MESSAGES/default.po
+++ b/priv/gettext/de/LC_MESSAGES/default.po
@@ -53,7 +53,7 @@ msgid "Ammo"
msgstr "Munition"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.ex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:96
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr "Munitionsarten"
@@ -118,7 +118,7 @@ msgstr "Gehäusematerial"
#: 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.ex:95
+#: lib/cannery_web/live/ammo_group_live/index.ex:101
#, elixir-autogen, elixir-format
msgid "Container"
msgstr "Behälter"
@@ -138,7 +138,7 @@ msgid "Corrosive"
msgstr "Korrosiv"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.ex:91
+#: lib/cannery_web/live/ammo_group_live/index.ex:97
#, elixir-autogen, elixir-format
msgid "Count"
msgstr "Anzahl"
@@ -360,7 +360,7 @@ msgid "Pressure"
msgstr "Druck"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.ex:92
+#: lib/cannery_web/live/ammo_group_live/index.ex:98
#, elixir-autogen, elixir-format
msgid "Price paid"
msgstr "Kaufpreis"
@@ -492,7 +492,7 @@ msgid "No tags for this container"
msgstr "Keine Tags für diesen Behälter"
#: lib/cannery_web/components/topbar.ex:81
-#: lib/cannery_web/live/ammo_group_live/index.ex:94
+#: lib/cannery_web/live/ammo_group_live/index.ex:100
#, elixir-autogen, elixir-format
msgid "Range"
msgstr "Schießplatz"
@@ -524,7 +524,7 @@ msgstr "Keine Munition selektiert"
msgid "Record shots"
msgstr "Schüsse dokumentieren"
-#: lib/cannery_web/live/ammo_group_live/index.ex:49
+#: lib/cannery_web/live/ammo_group_live/index.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo groups"
msgstr "Munitionsgruppen"
@@ -572,7 +572,7 @@ msgstr "Schießkladde"
msgid "Move Ammo group"
msgstr "Munitionsgruppe verschieben"
-#: lib/cannery_web/live/ammo_group_live/index.ex:253
+#: lib/cannery_web/live/ammo_group_live/index.ex:267
#, elixir-autogen, elixir-format
msgid "Move ammo"
msgstr "Munition verschieben"
@@ -588,7 +588,7 @@ msgid "Shot log"
msgstr "Schießkladde"
#: lib/cannery_web/components/ammo_group_card.ex:63
-#: lib/cannery_web/live/ammo_group_live/index.ex:145
+#: lib/cannery_web/live/ammo_group_live/index.ex:151
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:118
@@ -653,12 +653,12 @@ msgstr "Derzeitiges Passwort"
msgid "New password"
msgstr "Neues Passwort"
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Stage"
msgstr "Markiert"
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Unstage"
msgstr "Demarkiert"
@@ -709,7 +709,7 @@ msgstr "Zeige %{name}"
msgid "No cost information"
msgstr "Keine Preisinformationen"
-#: lib/cannery_web/live/ammo_group_live/index.ex:93
+#: lib/cannery_web/live/ammo_group_live/index.ex:99
#, elixir-autogen, elixir-format
msgid "% left"
msgstr "% verbleibend"
@@ -795,7 +795,7 @@ msgstr "Kopien"
msgid "Ammo types"
msgstr "Munitionsart"
-#: lib/cannery_web/live/ammo_group_live/index.ex:96
+#: lib/cannery_web/live/ammo_group_live/index.ex:102
#, elixir-autogen, elixir-format
msgid "Added on"
msgstr "Hinzugefügt am"
@@ -924,7 +924,7 @@ msgstr "Behälter"
msgid "Show used"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:101
+#: lib/cannery_web/live/ammo_group_live/index.ex:107
#, elixir-autogen, elixir-format
msgid "Used up on"
msgstr ""
@@ -934,7 +934,7 @@ msgstr ""
msgid "Used up on:"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:197
+#: lib/cannery_web/live/ammo_group_live/index.ex:203
#: lib/cannery_web/live/ammo_group_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "%{percentage}%"
diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po
index d3992c08..91b081df 100644
--- a/priv/gettext/de/LC_MESSAGES/errors.po
+++ b/priv/gettext/de/LC_MESSAGES/errors.po
@@ -175,12 +175,12 @@ msgstr ""
msgid "Tag could not be removed"
msgstr "Tag konnte nicht gelöscht werden"
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:156
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format
msgid "Could not parse number of copies"
msgstr "Konnte die Anzahl der Kopien nicht verstehen"
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:141
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po
index ef4feab9..73cc6c91 100644
--- a/priv/gettext/de/LC_MESSAGES/prompts.po
+++ b/priv/gettext/de/LC_MESSAGES/prompts.po
@@ -74,7 +74,7 @@ msgstr "%{name} erfolgreich aktualisiert"
msgid "A link to confirm your email change has been sent to the new address."
msgstr "Eine Mail zum Bestätigen ihre Mailadresse wurde Ihnen zugesandt."
-#: lib/cannery_web/live/ammo_group_live/index.ex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:62
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr "Munitionsgruppe erfolgreich gelöscht"
@@ -99,7 +99,7 @@ msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?"
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "Sind Sie sicher, dass sie die Einladung für %{name} löschen möchten?"
-#: lib/cannery_web/live/ammo_group_live/index.ex:225
+#: lib/cannery_web/live/ammo_group_live/index.ex:239
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?"
@@ -285,7 +285,7 @@ msgstr "Munition erfolgreich demarkiert"
msgid "Ammo updated successfully"
msgstr "Munitionsgruppe erfolgreich aktualisiert"
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:177
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format, fuzzy
msgid "Ammo added successfully"
msgid_plural "Ammo added successfully"
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index c60dcb1c..f700d661 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -38,7 +38,7 @@ msgid "Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.ex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:96
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
@@ -103,7 +103,7 @@ msgstr ""
#: 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.ex:95
+#: lib/cannery_web/live/ammo_group_live/index.ex:101
#, elixir-autogen, elixir-format
msgid "Container"
msgstr ""
@@ -123,7 +123,7 @@ msgid "Corrosive"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.ex:91
+#: lib/cannery_web/live/ammo_group_live/index.ex:97
#, elixir-autogen, elixir-format
msgid "Count"
msgstr ""
@@ -345,7 +345,7 @@ msgid "Pressure"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.ex:92
+#: lib/cannery_web/live/ammo_group_live/index.ex:98
#, elixir-autogen, elixir-format
msgid "Price paid"
msgstr ""
@@ -475,7 +475,7 @@ msgid "No tags for this container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:81
-#: lib/cannery_web/live/ammo_group_live/index.ex:94
+#: lib/cannery_web/live/ammo_group_live/index.ex:100
#, elixir-autogen, elixir-format
msgid "Range"
msgstr ""
@@ -507,7 +507,7 @@ msgstr ""
msgid "Record shots"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:49
+#: lib/cannery_web/live/ammo_group_live/index.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo groups"
msgstr ""
@@ -555,7 +555,7 @@ msgstr ""
msgid "Move Ammo group"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:253
+#: lib/cannery_web/live/ammo_group_live/index.ex:267
#, elixir-autogen, elixir-format
msgid "Move ammo"
msgstr ""
@@ -571,7 +571,7 @@ msgid "Shot log"
msgstr ""
#: lib/cannery_web/components/ammo_group_card.ex:63
-#: lib/cannery_web/live/ammo_group_live/index.ex:145
+#: lib/cannery_web/live/ammo_group_live/index.ex:151
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:118
@@ -636,12 +636,12 @@ msgstr ""
msgid "New password"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Stage"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Unstage"
msgstr ""
@@ -692,7 +692,7 @@ msgstr ""
msgid "No cost information"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:93
+#: lib/cannery_web/live/ammo_group_live/index.ex:99
#, elixir-autogen, elixir-format
msgid "% left"
msgstr ""
@@ -778,7 +778,7 @@ msgstr ""
msgid "Ammo types"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:96
+#: lib/cannery_web/live/ammo_group_live/index.ex:102
#, elixir-autogen, elixir-format
msgid "Added on"
msgstr ""
@@ -907,7 +907,7 @@ msgstr ""
msgid "Show used"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:101
+#: lib/cannery_web/live/ammo_group_live/index.ex:107
#, elixir-autogen, elixir-format
msgid "Used up on"
msgstr ""
@@ -917,7 +917,7 @@ msgstr ""
msgid "Used up on:"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:197
+#: lib/cannery_web/live/ammo_group_live/index.ex:203
#: lib/cannery_web/live/ammo_group_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "%{percentage}%"
diff --git a/priv/gettext/en/LC_MESSAGES/actions.po b/priv/gettext/en/LC_MESSAGES/actions.po
index e59e43a9..df700801 100644
--- a/priv/gettext/en/LC_MESSAGES/actions.po
+++ b/priv/gettext/en/LC_MESSAGES/actions.po
@@ -12,6 +12,7 @@ msgstr ""
"Plural-Forms: nplurals=2\n"
#: lib/cannery_web/live/ammo_group_live/index.ex:44
+#: lib/cannery_web/live/ammo_group_live/index.ex:50
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format
msgid "Add Ammo"
@@ -156,7 +157,7 @@ msgstr ""
msgid "Why not get some ready to shoot?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:190
+#: lib/cannery_web/live/ammo_group_live/index.ex:196
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index 7c2ec59f..1538a1f9 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -39,7 +39,7 @@ msgid "Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.ex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:96
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
@@ -104,7 +104,7 @@ msgstr ""
#: 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.ex:95
+#: lib/cannery_web/live/ammo_group_live/index.ex:101
#, elixir-autogen, elixir-format
msgid "Container"
msgstr ""
@@ -124,7 +124,7 @@ msgid "Corrosive"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.ex:91
+#: lib/cannery_web/live/ammo_group_live/index.ex:97
#, elixir-autogen, elixir-format
msgid "Count"
msgstr ""
@@ -346,7 +346,7 @@ msgid "Pressure"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.ex:92
+#: lib/cannery_web/live/ammo_group_live/index.ex:98
#, elixir-autogen, elixir-format
msgid "Price paid"
msgstr ""
@@ -476,7 +476,7 @@ msgid "No tags for this container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:81
-#: lib/cannery_web/live/ammo_group_live/index.ex:94
+#: lib/cannery_web/live/ammo_group_live/index.ex:100
#, elixir-autogen, elixir-format
msgid "Range"
msgstr ""
@@ -508,7 +508,7 @@ msgstr ""
msgid "Record shots"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:49
+#: lib/cannery_web/live/ammo_group_live/index.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo groups"
msgstr ""
@@ -556,7 +556,7 @@ msgstr ""
msgid "Move Ammo group"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:253
+#: lib/cannery_web/live/ammo_group_live/index.ex:267
#, elixir-autogen, elixir-format
msgid "Move ammo"
msgstr ""
@@ -572,7 +572,7 @@ msgid "Shot log"
msgstr ""
#: lib/cannery_web/components/ammo_group_card.ex:63
-#: lib/cannery_web/live/ammo_group_live/index.ex:145
+#: lib/cannery_web/live/ammo_group_live/index.ex:151
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:118
@@ -637,12 +637,12 @@ msgstr ""
msgid "New password"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Stage"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Unstage"
msgstr ""
@@ -693,7 +693,7 @@ msgstr ""
msgid "No cost information"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:93
+#: lib/cannery_web/live/ammo_group_live/index.ex:99
#, elixir-autogen, elixir-format
msgid "% left"
msgstr ""
@@ -779,7 +779,7 @@ msgstr ""
msgid "Ammo types"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:96
+#: lib/cannery_web/live/ammo_group_live/index.ex:102
#, elixir-autogen, elixir-format
msgid "Added on"
msgstr ""
@@ -908,7 +908,7 @@ msgstr ""
msgid "Show used"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:101
+#: lib/cannery_web/live/ammo_group_live/index.ex:107
#, elixir-autogen, elixir-format
msgid "Used up on"
msgstr ""
@@ -918,7 +918,7 @@ msgstr ""
msgid "Used up on:"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:197
+#: lib/cannery_web/live/ammo_group_live/index.ex:203
#: lib/cannery_web/live/ammo_group_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "%{percentage}%"
diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po
index a4218370..641ac74f 100644
--- a/priv/gettext/en/LC_MESSAGES/errors.po
+++ b/priv/gettext/en/LC_MESSAGES/errors.po
@@ -160,12 +160,12 @@ msgstr ""
msgid "Tag could not be removed"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:156
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format
msgid "Could not parse number of copies"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:141
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po
index d7f6bd72..fe12a597 100644
--- a/priv/gettext/en/LC_MESSAGES/prompts.po
+++ b/priv/gettext/en/LC_MESSAGES/prompts.po
@@ -62,7 +62,7 @@ msgstr ""
msgid "A link to confirm your email change has been sent to the new address."
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:62
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr ""
@@ -85,7 +85,7 @@ msgstr ""
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:225
+#: lib/cannery_web/live/ammo_group_live/index.ex:239
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?"
@@ -265,7 +265,7 @@ msgstr ""
msgid "Ammo updated successfully"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:177
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format, fuzzy
msgid "Ammo added successfully"
msgid_plural "Ammo added successfully"
diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot
index 39485141..38f019c3 100644
--- a/priv/gettext/errors.pot
+++ b/priv/gettext/errors.pot
@@ -159,12 +159,12 @@ msgstr ""
msgid "Tag could not be removed"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:156
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format
msgid "Could not parse number of copies"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:141
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
diff --git a/priv/gettext/es/LC_MESSAGES/actions.po b/priv/gettext/es/LC_MESSAGES/actions.po
index 4b6bf725..526a933f 100644
--- a/priv/gettext/es/LC_MESSAGES/actions.po
+++ b/priv/gettext/es/LC_MESSAGES/actions.po
@@ -24,6 +24,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44
+#: lib/cannery_web/live/ammo_group_live/index.ex:50
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format
msgid "Add Ammo"
@@ -168,7 +169,7 @@ msgstr ""
msgid "Why not get some ready to shoot?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:190
+#: lib/cannery_web/live/ammo_group_live/index.ex:196
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po
index c9b6abf3..9ad0f185 100644
--- a/priv/gettext/es/LC_MESSAGES/default.po
+++ b/priv/gettext/es/LC_MESSAGES/default.po
@@ -53,7 +53,7 @@ msgid "Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.ex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:96
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
@@ -118,7 +118,7 @@ msgstr ""
#: 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.ex:95
+#: lib/cannery_web/live/ammo_group_live/index.ex:101
#, elixir-autogen, elixir-format
msgid "Container"
msgstr ""
@@ -138,7 +138,7 @@ msgid "Corrosive"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.ex:91
+#: lib/cannery_web/live/ammo_group_live/index.ex:97
#, elixir-autogen, elixir-format
msgid "Count"
msgstr ""
@@ -360,7 +360,7 @@ msgid "Pressure"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.ex:92
+#: lib/cannery_web/live/ammo_group_live/index.ex:98
#, elixir-autogen, elixir-format
msgid "Price paid"
msgstr ""
@@ -490,7 +490,7 @@ msgid "No tags for this container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:81
-#: lib/cannery_web/live/ammo_group_live/index.ex:94
+#: lib/cannery_web/live/ammo_group_live/index.ex:100
#, elixir-autogen, elixir-format
msgid "Range"
msgstr ""
@@ -522,7 +522,7 @@ msgstr ""
msgid "Record shots"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:49
+#: lib/cannery_web/live/ammo_group_live/index.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo groups"
msgstr ""
@@ -570,7 +570,7 @@ msgstr ""
msgid "Move Ammo group"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:253
+#: lib/cannery_web/live/ammo_group_live/index.ex:267
#, elixir-autogen, elixir-format
msgid "Move ammo"
msgstr ""
@@ -586,7 +586,7 @@ msgid "Shot log"
msgstr ""
#: lib/cannery_web/components/ammo_group_card.ex:63
-#: lib/cannery_web/live/ammo_group_live/index.ex:145
+#: lib/cannery_web/live/ammo_group_live/index.ex:151
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:118
@@ -651,12 +651,12 @@ msgstr ""
msgid "New password"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Stage"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Unstage"
msgstr ""
@@ -707,7 +707,7 @@ msgstr ""
msgid "No cost information"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:93
+#: lib/cannery_web/live/ammo_group_live/index.ex:99
#, elixir-autogen, elixir-format
msgid "% left"
msgstr ""
@@ -793,7 +793,7 @@ msgstr ""
msgid "Ammo types"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:96
+#: lib/cannery_web/live/ammo_group_live/index.ex:102
#, elixir-autogen, elixir-format
msgid "Added on"
msgstr ""
@@ -922,7 +922,7 @@ msgstr ""
msgid "Show used"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:101
+#: lib/cannery_web/live/ammo_group_live/index.ex:107
#, elixir-autogen, elixir-format
msgid "Used up on"
msgstr ""
@@ -932,7 +932,7 @@ msgstr ""
msgid "Used up on:"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:197
+#: lib/cannery_web/live/ammo_group_live/index.ex:203
#: lib/cannery_web/live/ammo_group_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "%{percentage}%"
diff --git a/priv/gettext/es/LC_MESSAGES/errors.po b/priv/gettext/es/LC_MESSAGES/errors.po
index 26245488..35e99606 100644
--- a/priv/gettext/es/LC_MESSAGES/errors.po
+++ b/priv/gettext/es/LC_MESSAGES/errors.po
@@ -175,12 +175,12 @@ msgstr ""
msgid "Tag could not be removed"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:156
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format
msgid "Could not parse number of copies"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:141
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po
index 455cb62e..eef14d60 100644
--- a/priv/gettext/es/LC_MESSAGES/prompts.po
+++ b/priv/gettext/es/LC_MESSAGES/prompts.po
@@ -76,7 +76,7 @@ msgstr ""
"Un enlace para confirmar el correo electrónico ha sido enviado a la nueva "
"dirección."
-#: lib/cannery_web/live/ammo_group_live/index.ex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:62
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr "Grupo de Munición borrado exitosamente"
@@ -99,7 +99,7 @@ msgstr "Está seguro que desea eliminar %{name}?"
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "Está seguro que quiere eliminar la invitación para %{name}?"
-#: lib/cannery_web/live/ammo_group_live/index.ex:225
+#: lib/cannery_web/live/ammo_group_live/index.ex:239
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?"
@@ -284,7 +284,7 @@ msgstr ""
msgid "Ammo updated successfully"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:177
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format, fuzzy
msgid "Ammo added successfully"
msgid_plural "Ammo added successfully"
diff --git a/priv/gettext/fr/LC_MESSAGES/actions.po b/priv/gettext/fr/LC_MESSAGES/actions.po
index a96c5a56..e8008df3 100644
--- a/priv/gettext/fr/LC_MESSAGES/actions.po
+++ b/priv/gettext/fr/LC_MESSAGES/actions.po
@@ -24,6 +24,7 @@ msgstr ""
# # date. Leave "msgstr"s empty as changing them here has no
# # effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44
+#: lib/cannery_web/live/ammo_group_live/index.ex:50
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format
msgid "Add Ammo"
@@ -168,7 +169,7 @@ msgstr "Munition préparée"
msgid "Why not get some ready to shoot?"
msgstr "Pourquoi pas en préparer pour tirer ?"
-#: lib/cannery_web/live/ammo_group_live/index.ex:190
+#: lib/cannery_web/live/ammo_group_live/index.ex:196
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po
index 5aceca4d..721c3a96 100644
--- a/priv/gettext/fr/LC_MESSAGES/default.po
+++ b/priv/gettext/fr/LC_MESSAGES/default.po
@@ -53,7 +53,7 @@ msgid "Ammo"
msgstr "Munition"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.ex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:96
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr "Type de munition"
@@ -118,7 +118,7 @@ msgstr "Matériau de la caisse"
#: 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.ex:95
+#: lib/cannery_web/live/ammo_group_live/index.ex:101
#, elixir-autogen, elixir-format
msgid "Container"
msgstr "Conteneur"
@@ -138,7 +138,7 @@ msgid "Corrosive"
msgstr "Corrosive"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.ex:91
+#: lib/cannery_web/live/ammo_group_live/index.ex:97
#, elixir-autogen, elixir-format
msgid "Count"
msgstr "Quantité"
@@ -360,7 +360,7 @@ msgid "Pressure"
msgstr "Pression"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.ex:92
+#: lib/cannery_web/live/ammo_group_live/index.ex:98
#, elixir-autogen, elixir-format
msgid "Price paid"
msgstr "Prix payé"
@@ -494,7 +494,7 @@ msgid "No tags for this container"
msgstr "Aucun tag pour ce conteneur"
#: lib/cannery_web/components/topbar.ex:81
-#: lib/cannery_web/live/ammo_group_live/index.ex:94
+#: lib/cannery_web/live/ammo_group_live/index.ex:100
#, elixir-autogen, elixir-format
msgid "Range"
msgstr "Portée"
@@ -526,7 +526,7 @@ msgstr "Aucune munition sélectionnée"
msgid "Record shots"
msgstr "Tirs enregistrés"
-#: lib/cannery_web/live/ammo_group_live/index.ex:49
+#: lib/cannery_web/live/ammo_group_live/index.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo groups"
msgstr "Groupes de munition"
@@ -574,7 +574,7 @@ msgstr "Enregistrements de tir"
msgid "Move Ammo group"
msgstr "Déplacer le groupe de munition"
-#: lib/cannery_web/live/ammo_group_live/index.ex:253
+#: lib/cannery_web/live/ammo_group_live/index.ex:267
#, elixir-autogen, elixir-format
msgid "Move ammo"
msgstr "Déplacer munition"
@@ -590,7 +590,7 @@ msgid "Shot log"
msgstr "Évènements de tir"
#: lib/cannery_web/components/ammo_group_card.ex:63
-#: lib/cannery_web/live/ammo_group_live/index.ex:145
+#: lib/cannery_web/live/ammo_group_live/index.ex:151
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:118
@@ -655,12 +655,12 @@ msgstr "Mot de passe actuel"
msgid "New password"
msgstr "Nouveau mot de passe"
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Stage"
msgstr "Sélectionné"
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Unstage"
msgstr "Désélectionner"
@@ -711,7 +711,7 @@ msgstr "Montrer %{name}"
msgid "No cost information"
msgstr "Aucune information de prix"
-#: lib/cannery_web/live/ammo_group_live/index.ex:93
+#: lib/cannery_web/live/ammo_group_live/index.ex:99
#, elixir-autogen, elixir-format
msgid "% left"
msgstr "% restante"
@@ -797,7 +797,7 @@ msgstr "Exemplaires"
msgid "Ammo types"
msgstr "Types de munition"
-#: lib/cannery_web/live/ammo_group_live/index.ex:96
+#: lib/cannery_web/live/ammo_group_live/index.ex:102
#, elixir-autogen, elixir-format
msgid "Added on"
msgstr "Ajouté le"
@@ -927,7 +927,7 @@ msgstr "Conteneur"
msgid "Show used"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:101
+#: lib/cannery_web/live/ammo_group_live/index.ex:107
#, elixir-autogen, elixir-format
msgid "Used up on"
msgstr ""
@@ -937,7 +937,7 @@ msgstr ""
msgid "Used up on:"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:197
+#: lib/cannery_web/live/ammo_group_live/index.ex:203
#: lib/cannery_web/live/ammo_group_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "%{percentage}%"
diff --git a/priv/gettext/fr/LC_MESSAGES/errors.po b/priv/gettext/fr/LC_MESSAGES/errors.po
index ddb5c568..dcdec203 100644
--- a/priv/gettext/fr/LC_MESSAGES/errors.po
+++ b/priv/gettext/fr/LC_MESSAGES/errors.po
@@ -176,12 +176,12 @@ msgstr ""
msgid "Tag could not be removed"
msgstr "Le tag n’a pas pu être retiré"
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:156
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format
msgid "Could not parse number of copies"
msgstr "Impossible d'analyser le nombre de copies"
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:141
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}"
diff --git a/priv/gettext/fr/LC_MESSAGES/prompts.po b/priv/gettext/fr/LC_MESSAGES/prompts.po
index 0f01ffe7..2bd213e0 100644
--- a/priv/gettext/fr/LC_MESSAGES/prompts.po
+++ b/priv/gettext/fr/LC_MESSAGES/prompts.po
@@ -76,7 +76,7 @@ msgstr ""
"Un lien pour confirmer votre changement de mél a été envoyé à la nouvelle "
"adresse."
-#: lib/cannery_web/live/ammo_group_live/index.ex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:62
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr "Groupe de munition supprimé avec succès"
@@ -100,7 +100,7 @@ msgstr "Êtes-vous certain·e de supprimer %{name} ?"
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "Êtes-vous certain·e de supprimer l’invitation pour %{name} ?"
-#: lib/cannery_web/live/ammo_group_live/index.ex:225
+#: lib/cannery_web/live/ammo_group_live/index.ex:239
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?"
@@ -286,7 +286,7 @@ msgstr "Groupe de munition désélectionner avec succès"
msgid "Ammo updated successfully"
msgstr "Groupe de munition mis à jour avec succès"
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:177
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format, fuzzy
msgid "Ammo added successfully"
msgid_plural "Ammo added successfully"
diff --git a/priv/gettext/ga/LC_MESSAGES/actions.po b/priv/gettext/ga/LC_MESSAGES/actions.po
index e058e4fe..0307ecff 100644
--- a/priv/gettext/ga/LC_MESSAGES/actions.po
+++ b/priv/gettext/ga/LC_MESSAGES/actions.po
@@ -22,6 +22,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44
+#: lib/cannery_web/live/ammo_group_live/index.ex:50
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format
msgid "Add Ammo"
@@ -166,7 +167,7 @@ msgstr ""
msgid "Why not get some ready to shoot?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:190
+#: lib/cannery_web/live/ammo_group_live/index.ex:196
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/ga/LC_MESSAGES/default.po b/priv/gettext/ga/LC_MESSAGES/default.po
index 0e6bae60..25a2f595 100644
--- a/priv/gettext/ga/LC_MESSAGES/default.po
+++ b/priv/gettext/ga/LC_MESSAGES/default.po
@@ -49,7 +49,7 @@ msgid "Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:21
-#: lib/cannery_web/live/ammo_group_live/index.ex:90
+#: lib/cannery_web/live/ammo_group_live/index.ex:96
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
@@ -114,7 +114,7 @@ msgstr ""
#: 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.ex:95
+#: lib/cannery_web/live/ammo_group_live/index.ex:101
#, elixir-autogen, elixir-format
msgid "Container"
msgstr ""
@@ -134,7 +134,7 @@ msgid "Corrosive"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:27
-#: lib/cannery_web/live/ammo_group_live/index.ex:91
+#: lib/cannery_web/live/ammo_group_live/index.ex:97
#, elixir-autogen, elixir-format
msgid "Count"
msgstr ""
@@ -356,7 +356,7 @@ msgid "Pressure"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:34
-#: lib/cannery_web/live/ammo_group_live/index.ex:92
+#: lib/cannery_web/live/ammo_group_live/index.ex:98
#, elixir-autogen, elixir-format
msgid "Price paid"
msgstr ""
@@ -486,7 +486,7 @@ msgid "No tags for this container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:81
-#: lib/cannery_web/live/ammo_group_live/index.ex:94
+#: lib/cannery_web/live/ammo_group_live/index.ex:100
#, elixir-autogen, elixir-format
msgid "Range"
msgstr ""
@@ -518,7 +518,7 @@ msgstr ""
msgid "Record shots"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:49
+#: lib/cannery_web/live/ammo_group_live/index.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo groups"
msgstr ""
@@ -566,7 +566,7 @@ msgstr ""
msgid "Move Ammo group"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:253
+#: lib/cannery_web/live/ammo_group_live/index.ex:267
#, elixir-autogen, elixir-format
msgid "Move ammo"
msgstr ""
@@ -582,7 +582,7 @@ msgid "Shot log"
msgstr ""
#: lib/cannery_web/components/ammo_group_card.ex:63
-#: lib/cannery_web/live/ammo_group_live/index.ex:145
+#: lib/cannery_web/live/ammo_group_live/index.ex:151
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:118
@@ -647,12 +647,12 @@ msgstr ""
msgid "New password"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Stage"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:183
+#: lib/cannery_web/live/ammo_group_live/index.ex:189
#, elixir-autogen, elixir-format
msgid "Unstage"
msgstr ""
@@ -703,7 +703,7 @@ msgstr ""
msgid "No cost information"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:93
+#: lib/cannery_web/live/ammo_group_live/index.ex:99
#, elixir-autogen, elixir-format
msgid "% left"
msgstr ""
@@ -789,7 +789,7 @@ msgstr ""
msgid "Ammo types"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:96
+#: lib/cannery_web/live/ammo_group_live/index.ex:102
#, elixir-autogen, elixir-format
msgid "Added on"
msgstr ""
@@ -918,7 +918,7 @@ msgstr ""
msgid "Show used"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:101
+#: lib/cannery_web/live/ammo_group_live/index.ex:107
#, elixir-autogen, elixir-format
msgid "Used up on"
msgstr ""
@@ -928,7 +928,7 @@ msgstr ""
msgid "Used up on:"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:197
+#: lib/cannery_web/live/ammo_group_live/index.ex:203
#: lib/cannery_web/live/ammo_group_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "%{percentage}%"
diff --git a/priv/gettext/ga/LC_MESSAGES/errors.po b/priv/gettext/ga/LC_MESSAGES/errors.po
index ff0f77ec..40cfe6fb 100644
--- a/priv/gettext/ga/LC_MESSAGES/errors.po
+++ b/priv/gettext/ga/LC_MESSAGES/errors.po
@@ -175,12 +175,12 @@ msgstr ""
msgid "Tag could not be removed"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:156
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format
msgid "Could not parse number of copies"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:141
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
diff --git a/priv/gettext/ga/LC_MESSAGES/prompts.po b/priv/gettext/ga/LC_MESSAGES/prompts.po
index 757d84c3..79cbd25e 100644
--- a/priv/gettext/ga/LC_MESSAGES/prompts.po
+++ b/priv/gettext/ga/LC_MESSAGES/prompts.po
@@ -72,7 +72,7 @@ msgstr ""
msgid "A link to confirm your email change has been sent to the new address."
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:62
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr ""
@@ -95,7 +95,7 @@ msgstr ""
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:225
+#: lib/cannery_web/live/ammo_group_live/index.ex:239
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?"
@@ -275,7 +275,7 @@ msgstr ""
msgid "Ammo updated successfully"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:177
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format
msgid "Ammo added successfully"
msgid_plural "Ammo added successfully"
diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot
index 616a32ee..15c2d35d 100644
--- a/priv/gettext/prompts.pot
+++ b/priv/gettext/prompts.pot
@@ -61,7 +61,7 @@ msgstr ""
msgid "A link to confirm your email change has been sent to the new address."
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:56
+#: lib/cannery_web/live/ammo_group_live/index.ex:62
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr ""
@@ -84,7 +84,7 @@ msgstr ""
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/index.ex:225
+#: lib/cannery_web/live/ammo_group_live/index.ex:239
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?"
@@ -264,7 +264,7 @@ msgstr ""
msgid "Ammo updated successfully"
msgstr ""
-#: lib/cannery_web/live/ammo_group_live/form_component.ex:177
+#: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format
msgid "Ammo added successfully"
msgid_plural "Ammo added successfully"
diff --git a/test/cannery_web/live/ammo_group_live_test.exs b/test/cannery_web/live/ammo_group_live_test.exs
index 4e689702..3f15ff47 100644
--- a/test/cannery_web/live/ammo_group_live_test.exs
+++ b/test/cannery_web/live/ammo_group_live_test.exs
@@ -18,7 +18,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
@create_attrs %{"count" => 42, "notes" => "some notes", "price_paid" => 120.5}
@update_attrs %{"count" => 43, "notes" => "some updated notes", "price_paid" => 456.7}
@ammo_group_create_limit 10_000
- @ammo_group_attrs %{
+ @empty_attrs %{
"price_paid" => 50,
"count" => 20
}
@@ -32,7 +32,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
defp create_ammo_group(%{current_user: current_user}) do
ammo_type = ammo_type_fixture(current_user)
container = container_fixture(current_user)
- {1, [ammo_group]} = ammo_group_fixture(ammo_type, container, current_user)
+ {1, [ammo_group]} = ammo_group_fixture(@create_attrs, ammo_type, container, current_user)
%{ammo_type: ammo_type, ammo_group: ammo_group, container: container}
end
@@ -49,7 +49,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
ammo_type: ammo_type,
container: container
}) do
- {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user)
+ {1, [ammo_group]} = ammo_group_fixture(@empty_attrs, ammo_type, container, current_user)
shot_group = shot_group_fixture(@shot_group_attrs, current_user, ammo_group)
ammo_group = ammo_group |> Repo.reload!()
%{empty_ammo_group: ammo_group, shot_group: shot_group}
@@ -70,7 +70,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
{:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index))
assert index_live |> element("a", dgettext("actions", "Add Ammo")) |> render_click() =~
- gettext("Add Ammo")
+ dgettext("actions", "Add Ammo")
assert_patch(index_live, Routes.ammo_group_index_path(conn, :new))
@@ -94,7 +94,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
{:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index))
assert index_live |> element("a", dgettext("actions", "Add Ammo")) |> render_click() =~
- gettext("Add Ammo")
+ dgettext("actions", "Add Ammo")
assert_patch(index_live, Routes.ammo_group_index_path(conn, :new))
@@ -118,7 +118,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
{:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index))
assert index_live |> element("a", dgettext("actions", "Add Ammo")) |> render_click() =~
- gettext("Add Ammo")
+ dgettext("actions", "Add Ammo")
assert_patch(index_live, Routes.ammo_group_index_path(conn, :new))
@@ -174,6 +174,62 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
assert html =~ "43"
end
+ test "clones ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do
+ {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index))
+
+ html =
+ index_live
+ |> element("[data-qa=\"clone-#{ammo_group.id}\"]")
+ |> render_click()
+
+ assert html =~ dgettext("actions", "Add Ammo")
+ assert html =~ gettext("$%{amount}", amount: 120.5 |> :erlang.float_to_binary(decimals: 2))
+
+ assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group))
+
+ # assert index_live
+ # |> form("#ammo_group-form", ammo_group: @invalid_attrs)
+ # |> render_change() =~ dgettext("errors", "can't be blank")
+
+ {:ok, _view, html} =
+ index_live
+ |> form("#ammo_group-form")
+ |> render_submit()
+ |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index))
+
+ assert html =~ dgettext("prompts", "Ammo added successfully")
+ assert html =~ "42"
+ assert html =~ gettext("$%{amount}", amount: 120.5 |> :erlang.float_to_binary(decimals: 2))
+ end
+
+ test "clones ammo_group in listing with updates", %{conn: conn, ammo_group: ammo_group} do
+ {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index))
+
+ html =
+ index_live
+ |> element("[data-qa=\"clone-#{ammo_group.id}\"]")
+ |> render_click()
+
+ assert html =~ dgettext("actions", "Add Ammo")
+ assert html =~ gettext("$%{amount}", amount: 120.5 |> :erlang.float_to_binary(decimals: 2))
+
+ assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group))
+
+ # assert index_live
+ # |> form("#ammo_group-form", ammo_group: @invalid_attrs)
+ # |> render_change() =~ dgettext("errors", "can't be blank")
+
+ {:ok, _view, html} =
+ index_live
+ |> form("#ammo_group-form", ammo_group: Map.merge(@create_attrs, %{"count" => 43}))
+ |> render_submit()
+ |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index))
+
+ assert html =~ dgettext("prompts", "Ammo added successfully")
+ assert html =~ "43"
+ assert html =~ gettext("$%{amount}", amount: 120.5 |> :erlang.float_to_binary(decimals: 2))
+ end
+
test "deletes ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do
{:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index))