add button to set shot group to zero
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
shibao 2022-11-10 22:01:32 -05:00
parent 1c7721887f
commit 0c088ed06d
22 changed files with 76 additions and 27 deletions

View File

@ -17,6 +17,7 @@
- Add ammo type cloning
- Add container cloning
- Fix bug with moving ammo packs between containers
- Add button to set rounds left to 0 when creating a shot group
- Update project dependencies
# v0.5.4

View File

@ -67,3 +67,8 @@ window.addEventListener('cannery:clipcopy', (event) => {
window.alert('Sorry, your browser does not support clipboard copy.')
}
})
// Set input value to 0
window.addEventListener('cannery:set-zero', (event) => {
event.target.value = 0
})

View File

@ -5,7 +5,7 @@ defmodule CanneryWeb.Components.AddShotGroupComponent do
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, ActivityLog, ActivityLog.ShotGroup, Ammo.AmmoGroup}
alias Phoenix.LiveView.Socket
alias Phoenix.LiveView.{JS, Socket}
@impl true
@spec update(

View File

@ -22,9 +22,16 @@
<%= number_input(f, :ammo_left,
min: 0,
max: @ammo_group.count - 1,
placeholder: 0,
class: "input input-primary col-span-2"
placeholder: gettext("Rounds left"),
class: "input input-primary"
) %>
<button
type="button"
class="mx-2 my-1 text-sm btn btn-primary"
phx-click={JS.dispatch("cannery:set-zero", to: "#shot-group-form_ammo_left")}
>
<%= gettext("Used up!") %>
</button>
<%= error_tag(f, :ammo_left, "col-span-3") %>
<%= label(f, :notes, gettext("Notes"), class: "title text-lg text-primary-600") %>

View File

@ -120,7 +120,7 @@ msgstr ""
msgid "Reset password"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:46
#: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50

View File

@ -133,7 +133,7 @@ msgstr "Bestätigungsmail erneut senden"
msgid "Reset password"
msgstr "Passwort zurücksetzen"
#: lib/cannery_web/components/add_shot_group_component.html.heex:46
#: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50

View File

@ -338,7 +338,7 @@ msgstr "Keine Einladung"
msgid "No tags"
msgstr "Keine Tags"
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/components/add_shot_group_component.html.heex:37
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
#: lib/cannery_web/live/ammo_group_live/show.ex:88
#: lib/cannery_web/live/range_live/form_component.html.heex:29
@ -537,7 +537,7 @@ msgstr "Schüsse dokumentieren"
msgid "Ammo groups"
msgstr "Munitionsgruppen"
#: lib/cannery_web/components/add_shot_group_component.html.heex:38
#: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/range_live/form_component.html.heex:36
#, elixir-autogen, elixir-format
msgid "Date (UTC)"
@ -560,6 +560,7 @@ msgid "No shots recorded"
msgstr "Keine Schüsse dokumentiert"
#: lib/cannery_web/components/add_shot_group_component.html.heex:21
#: lib/cannery_web/components/add_shot_group_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Rounds left"
msgstr "Patronen verbleibend"
@ -1012,3 +1013,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:33
#, elixir-autogen, elixir-format, fuzzy
msgid "Used up!"
msgstr ""

View File

@ -165,7 +165,7 @@ msgstr "Bitte überprüfen Sie ihre Mailbox und bestätigen Sie das Nutzerkonto"
msgid "Register to setup %{name}"
msgstr "Registrieren Sie sich, um %{name} zu bearbeiten"
#: lib/cannery_web/components/add_shot_group_component.html.heex:48
#: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52

View File

@ -323,7 +323,7 @@ msgstr ""
msgid "No tags"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/components/add_shot_group_component.html.heex:37
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
#: lib/cannery_web/live/ammo_group_live/show.ex:88
#: lib/cannery_web/live/range_live/form_component.html.heex:29
@ -520,7 +520,7 @@ msgstr ""
msgid "Ammo groups"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:38
#: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/range_live/form_component.html.heex:36
#, elixir-autogen, elixir-format
msgid "Date (UTC)"
@ -543,6 +543,7 @@ msgid "No shots recorded"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:21
#: lib/cannery_web/components/add_shot_group_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Rounds left"
msgstr ""
@ -995,3 +996,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Used rounds:"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:33
#, elixir-autogen, elixir-format
msgid "Used up!"
msgstr ""

View File

@ -121,7 +121,7 @@ msgstr ""
msgid "Reset password"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:46
#: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50

View File

@ -324,7 +324,7 @@ msgstr ""
msgid "No tags"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/components/add_shot_group_component.html.heex:37
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
#: lib/cannery_web/live/ammo_group_live/show.ex:88
#: lib/cannery_web/live/range_live/form_component.html.heex:29
@ -521,7 +521,7 @@ msgstr ""
msgid "Ammo groups"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:38
#: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/range_live/form_component.html.heex:36
#, elixir-autogen, elixir-format
msgid "Date (UTC)"
@ -544,6 +544,7 @@ msgid "No shots recorded"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:21
#: lib/cannery_web/components/add_shot_group_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Rounds left"
msgstr ""
@ -996,3 +997,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:33
#, elixir-autogen, elixir-format, fuzzy
msgid "Used up!"
msgstr ""

View File

@ -147,7 +147,7 @@ msgstr ""
msgid "Register to setup %{name}"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:48
#: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52

View File

@ -133,7 +133,7 @@ msgstr ""
msgid "Reset password"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:46
#: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50

View File

@ -338,7 +338,7 @@ msgstr ""
msgid "No tags"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/components/add_shot_group_component.html.heex:37
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
#: lib/cannery_web/live/ammo_group_live/show.ex:88
#: lib/cannery_web/live/range_live/form_component.html.heex:29
@ -535,7 +535,7 @@ msgstr ""
msgid "Ammo groups"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:38
#: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/range_live/form_component.html.heex:36
#, elixir-autogen, elixir-format
msgid "Date (UTC)"
@ -558,6 +558,7 @@ msgid "No shots recorded"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:21
#: lib/cannery_web/components/add_shot_group_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Rounds left"
msgstr ""
@ -1010,3 +1011,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:33
#, elixir-autogen, elixir-format, fuzzy
msgid "Used up!"
msgstr ""

View File

@ -165,7 +165,7 @@ msgstr "Por favor chequea el correo para verificar tu cuenta"
msgid "Register to setup %{name}"
msgstr "Regístrese para configurar %{name}"
#: lib/cannery_web/components/add_shot_group_component.html.heex:48
#: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52

View File

@ -133,7 +133,7 @@ msgstr "Renvoyer les instructions de confirmation"
msgid "Reset password"
msgstr "Réinitialisé le mot de passe"
#: lib/cannery_web/components/add_shot_group_component.html.heex:46
#: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50

View File

@ -338,7 +338,7 @@ msgstr "Aucune invitation"
msgid "No tags"
msgstr "Aucun tag"
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/components/add_shot_group_component.html.heex:37
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
#: lib/cannery_web/live/ammo_group_live/show.ex:88
#: lib/cannery_web/live/range_live/form_component.html.heex:29
@ -539,7 +539,7 @@ msgstr "Tirs enregistrés"
msgid "Ammo groups"
msgstr "Groupes de munition"
#: lib/cannery_web/components/add_shot_group_component.html.heex:38
#: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/range_live/form_component.html.heex:36
#, elixir-autogen, elixir-format
msgid "Date (UTC)"
@ -562,6 +562,7 @@ msgid "No shots recorded"
msgstr "Aucun tir enregistré"
#: lib/cannery_web/components/add_shot_group_component.html.heex:21
#: lib/cannery_web/components/add_shot_group_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Rounds left"
msgstr "Cartouches restantes"
@ -1015,3 +1016,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:33
#, elixir-autogen, elixir-format, fuzzy
msgid "Used up!"
msgstr ""

View File

@ -166,7 +166,7 @@ msgstr "Veuillez vérifier votre mél pour confirmer votre compte"
msgid "Register to setup %{name}"
msgstr "Senregistrer pour mettre en place %{name}"
#: lib/cannery_web/components/add_shot_group_component.html.heex:48
#: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52

View File

@ -131,7 +131,7 @@ msgstr ""
msgid "Reset password"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:46
#: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50

View File

@ -334,7 +334,7 @@ msgstr ""
msgid "No tags"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:30
#: lib/cannery_web/components/add_shot_group_component.html.heex:37
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41
#: lib/cannery_web/live/ammo_group_live/show.ex:88
#: lib/cannery_web/live/range_live/form_component.html.heex:29
@ -531,7 +531,7 @@ msgstr ""
msgid "Ammo groups"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:38
#: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/range_live/form_component.html.heex:36
#, elixir-autogen, elixir-format
msgid "Date (UTC)"
@ -554,6 +554,7 @@ msgid "No shots recorded"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:21
#: lib/cannery_web/components/add_shot_group_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Rounds left"
msgstr ""
@ -1006,3 +1007,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:33
#, elixir-autogen, elixir-format, fuzzy
msgid "Used up!"
msgstr ""

View File

@ -157,7 +157,7 @@ msgstr ""
msgid "Register to setup %{name}"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:48
#: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52

View File

@ -146,7 +146,7 @@ msgstr ""
msgid "Register to setup %{name}"
msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:48
#: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52