update deps
Some checks failed
continuous-integration/drone/tag Build is failing
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-04-05 00:13:01 +00:00
parent 449a92e4b7
commit 37d101a71e
130 changed files with 1748 additions and 12180 deletions

View File

@ -1,6 +1,6 @@
<div>
<h2 class="mb-8 text-center title text-xl text-primary-600">
<%= @title %>
{@title}
</h2>
<.form
@ -16,11 +16,11 @@
:if={@changeset.action && not @changeset.valid?}
class="invalid-feedback col-span-3 text-center"
>
<%= changeset_errors(@changeset) %>
{changeset_errors(@changeset)}
</div>
<%= label(f, :class, gettext("Class"), class: "title text-lg text-primary-600") %>
<%= select(
{label(f, :class, gettext("Class"), class: "title text-lg text-primary-600")}
{select(
f,
:class,
[
@ -31,86 +31,86 @@
],
class: "text-center col-span-2 input input-primary",
value: @class
) %>
<%= error_tag(f, :class, "col-span-3 text-center") %>
)}
{error_tag(f, :class, "col-span-3 text-center")}
<%= label(f, :type_id, gettext("Type"), class: "title text-lg text-primary-600") %>
<%= select(f, :type_id, type_options(@types, @class),
{label(f, :type_id, gettext("Type"), class: "title text-lg text-primary-600")}
{select(f, :type_id, type_options(@types, @class),
class: "text-center col-span-2 input input-primary",
id: "pack-form-type-select",
phx_hook: "SlimSelect"
) %>
<%= error_tag(f, :type_id, "col-span-3 text-center") %>
)}
{error_tag(f, :type_id, "col-span-3 text-center")}
<%= label(f, :count, gettext("Count"), class: "title text-lg text-primary-600") %>
<%= number_input(f, :count,
{label(f, :count, gettext("Count"), class: "title text-lg text-primary-600")}
{number_input(f, :count,
class: "text-center col-span-2 input input-primary",
min: 0
) %>
<%= error_tag(f, :count, "col-span-3 text-center") %>
)}
{error_tag(f, :count, "col-span-3 text-center")}
<%= label(f, :price_paid, gettext("Price paid"), class: "title text-lg text-primary-600") %>
<%= number_input(f, :price_paid,
{label(f, :price_paid, gettext("Price paid"), class: "title text-lg text-primary-600")}
{number_input(f, :price_paid,
step: 0.01,
class: "text-center col-span-2 input input-primary"
) %>
<%= error_tag(f, :price_paid, "col-span-3 text-center") %>
)}
{error_tag(f, :price_paid, "col-span-3 text-center")}
<%= label(f, :lot_number, gettext("Lot number"), class: "title text-lg text-primary-600") %>
<%= text_input(f, :lot_number,
{label(f, :lot_number, gettext("Lot number"), class: "title text-lg text-primary-600")}
{text_input(f, :lot_number,
class: "text-center col-span-2 input input-primary",
maxlength: 255,
phx_debounce: 300
) %>
<%= error_tag(f, :price_paid, "col-span-3 text-center") %>
)}
{error_tag(f, :price_paid, "col-span-3 text-center")}
<%= label(f, :purchased_on, gettext("Purchased on"), class: "title text-lg text-primary-600") %>
<%= date_input(f, :purchased_on,
{label(f, :purchased_on, gettext("Purchased on"), class: "title text-lg text-primary-600")}
{date_input(f, :purchased_on,
class: "input input-primary col-span-2",
phx_update: "ignore",
value: @changeset |> Changeset.get_field(:purchased_on) || Date.utc_today()
) %>
<%= error_tag(f, :purchased_on, "col-span-3 text-center") %>
)}
{error_tag(f, :purchased_on, "col-span-3 text-center")}
<%= label(f, :notes, gettext("Notes"), class: "title text-lg text-primary-600") %>
<%= textarea(f, :notes,
{label(f, :notes, gettext("Notes"), class: "title text-lg text-primary-600")}
{textarea(f, :notes,
class: "text-center col-span-2 input input-primary",
id: "pack-form-notes",
phx_debounce: 300,
phx_update: "ignore"
) %>
<%= error_tag(f, :notes, "col-span-3 text-center") %>
)}
{error_tag(f, :notes, "col-span-3 text-center")}
<%= label(f, :container, gettext("Container"), class: "title text-lg text-primary-600") %>
<%= select(f, :container_id, container_options(@containers),
{label(f, :container, gettext("Container"), class: "title text-lg text-primary-600")}
{select(f, :container_id, container_options(@containers),
class: "text-center col-span-2 input input-primary",
id: "pack-form-container-select",
phx_hook: "SlimSelect"
) %>
<%= error_tag(f, :container_id, "col-span-3 text-center") %>
)}
{error_tag(f, :container_id, "col-span-3 text-center")}
<%= case @action do %>
<% action when action in [:new, :clone] -> %>
<hr class="hr col-span-3" />
<%= label(f, :multiplier, gettext("Copies"), class: "title text-lg text-primary-600") %>
<%= number_input(f, :multiplier,
{label(f, :multiplier, gettext("Copies"), class: "title text-lg text-primary-600")}
{number_input(f, :multiplier,
class: "text-center input input-primary",
value: 1,
phx_update: "ignore"
) %>
)}
<%= submit(dgettext("actions", "Create"),
{submit(dgettext("actions", "Create"),
phx_disable_with: dgettext("prompts", "Creating..."),
class: "mx-auto btn btn-primary"
) %>
)}
<%= error_tag(f, :multiplier, "col-span-3 text-center") %>
{error_tag(f, :multiplier, "col-span-3 text-center")}
<% :edit -> %>
<%= submit(dgettext("actions", "Save"),
{submit(dgettext("actions", "Save"),
phx_disable_with: dgettext("prompts", "Saving..."),
class: "mx-auto col-span-3 btn btn-primary"
) %>
)}
<% end %>
</.form>
</div>

View File

@ -1,44 +1,44 @@
<div class="flex flex-col justify-center items-center space-y-8">
<h1 class="text-2xl title title-primary-500">
<%= gettext("Ammo") %>
{gettext("Ammo")}
</h1>
<%= cond do %>
<% @containers_count == 0 -> %>
<div class="flex justify-center items-center">
<h2 class="m-2 title text-md text-primary-600">
<%= dgettext("prompts", "You'll need to") %>
{dgettext("prompts", "You'll need to")}
</h2>
<.link navigate={~p"/containers/new"} class="btn btn-primary">
<%= dgettext("actions", "add a container first") %>
{dgettext("actions", "add a container first")}
</.link>
</div>
<% @types_count == 0 -> %>
<div class="flex justify-center items-center">
<h2 class="m-2 title text-md text-primary-600">
<%= dgettext("prompts", "You'll need to") %>
{dgettext("prompts", "You'll need to")}
</h2>
<.link navigate={~p"/catalog/new"} class="btn btn-primary">
<%= dgettext("actions", "add a type first") %>
{dgettext("actions", "add a type first")}
</.link>
</div>
<% @packs_count == 0 -> %>
<h2 class="text-xl title text-primary-600">
<%= gettext("No ammo") %>
<%= display_emoji("😔") %>
{gettext("No ammo")}
{display_emoji("😔")}
</h2>
<.link patch={~p"/ammo/new"} class="btn btn-primary">
<%= dgettext("actions", "Add your first box!") %>
{dgettext("actions", "Add your first box!")}
</.link>
<% true -> %>
<.link patch={~p"/ammo/new"} class="btn btn-primary">
<%= dgettext("actions", "Add Ammo") %>
{dgettext("actions", "Add Ammo")}
</.link>
<div class="flex flex-col justify-center items-center space-y-4 w-full max-w-2xl sm:flex-row sm:space-y-0 sm:space-x-4">
<div class="flex flex-col flex-wrap justify-center items-center space-y-4 w-full sm:flex-row sm:space-y-0 sm:space-x-4">
<.form
:let={f}
for={%{}}
@ -47,11 +47,9 @@
phx-submit="change_class"
class="flex items-center"
>
<%= label(f, :class, gettext("Class"),
class: "title text-primary-600 text-lg text-center"
) %>
{label(f, :class, gettext("Class"), class: "title text-primary-600 text-lg text-center")}
<%= select(
{select(
f,
:class,
[
@ -60,9 +58,9 @@
{gettext("Shotgun"), :shotgun},
{gettext("Pistol"), :pistol}
],
class: "mx-2 my-1 min-w-md input input-primary",
class: "mx-2 my-1 min-w-20 input input-primary",
value: @class
) %>
)}
</.form>
<.form
@ -73,26 +71,26 @@
phx-submit="search"
class="flex items-center grow"
>
<%= text_input(f, :search_term,
{text_input(f, :search_term,
class: "grow input input-primary",
phx_debounce: 300,
placeholder: gettext("Search ammo"),
role: "search",
value: @search
) %>
)}
</.form>
<.toggle_button action="toggle_show_used" value={@show_used}>
<span class="text-lg title text-primary-600">
<%= gettext("Show used") %>
{gettext("Show used")}
</span>
</.toggle_button>
</div>
<%= if @packs |> Enum.empty?() do %>
<h2 class="text-xl title text-primary-600">
<%= gettext("No Ammo") %>
<%= display_emoji("😔") %>
{gettext("No Ammo")}
{display_emoji("😔")}
</h2>
<% else %>
<.live_component
@ -104,7 +102,7 @@
>
<:type :let={%{name: type_name} = type}>
<.link navigate={~p"/type/#{type}"} class="link">
<%= type_name %>
{type_name}
</.link>
</:type>
<:range :let={pack}>
@ -113,18 +111,18 @@
patch={~p"/ammo/add_shot_record/#{pack}"}
class="mx-2 my-1 text-sm btn btn-primary"
>
<%= dgettext("actions", "Record shots") %>
{dgettext("actions", "Record shots")}
</.link>
</div>
</:range>
<:container :let={{pack, %{name: container_name} = container}}>
<div class="flex flex-wrap justify-center items-center px-4 py-2 h-full min-w-20">
<.link navigate={~p"/container/#{container}"} class="mx-2 my-1 link">
<%= container_name %>
{container_name}
</.link>
<.link patch={~p"/ammo/move/#{pack}"} class="mx-2 my-1 text-sm btn btn-primary">
<%= dgettext("actions", "Move ammo") %>
{dgettext("actions", "Move ammo")}
</.link>
</div>
</:container>

View File

@ -1,47 +1,47 @@
<div class="flex flex-col justify-center items-center mx-auto space-y-4 max-w-3xl">
<h1 class="text-2xl title title-primary-500">
<%= @pack.type.name %>
{@pack.type.name}
</h1>
<div class="flex flex-col justify-center items-center space-y-2">
<span class="text-lg rounded-lg title">
<%= gettext("Count:") %>
<%= @pack.count %>
{gettext("Count:")}
{@pack.count}
</span>
<span class="text-lg rounded-lg title">
<%= gettext("Original count:") %>
<%= @original_count %>
{gettext("Original count:")}
{@original_count}
</span>
<span class="text-lg rounded-lg title">
<%= gettext("Percentage left:") %>
<%= gettext("%{percentage}%", percentage: @percentage_remaining) %>
{gettext("Percentage left:")}
{gettext("%{percentage}%", percentage: @percentage_remaining)}
</span>
<%= if @pack.notes do %>
<span class="text-lg rounded-lg title">
<%= gettext("Notes:") %>
<%= @pack.notes %>
{gettext("Notes:")}
{@pack.notes}
</span>
<% end %>
<span class="text-lg rounded-lg title">
<%= gettext("Purchased on:") %>
{gettext("Purchased on:")}
<.date id={"#{@pack.id}-purchased-on"} date={@pack.purchased_on} />
</span>
<%= if @pack.price_paid do %>
<span class="text-lg rounded-lg title">
<%= gettext("Original cost:") %>
<%= gettext("$%{amount}", amount: display_currency(@pack.price_paid)) %>
{gettext("Original cost:")}
{gettext("$%{amount}", amount: display_currency(@pack.price_paid))}
</span>
<span class="text-lg rounded-lg title">
<%= gettext("Current value:") %>
<%= gettext("$%{amount}",
{gettext("Current value:")}
{gettext("$%{amount}",
amount: display_currency(@pack.price_paid * @percentage_remaining / 100)
) %>
)}
</span>
<% end %>
</div>
@ -49,7 +49,7 @@
<div class="flex flex-col justify-center items-center">
<div class="flex flex-wrap justify-center items-center text-primary-600">
<.link navigate={~p"/type/#{@pack.type}"} class="mx-4 my-2 btn btn-primary">
<%= dgettext("actions", "View in Catalog") %>
{dgettext("actions", "View in Catalog")}
</.link>
<.link
@ -77,11 +77,11 @@
<div class="flex flex-wrap justify-center items-center text-primary-600">
<.link patch={~p"/ammo/show/move/#{@pack}"} class="btn btn-primary">
<%= dgettext("actions", "Move ammo") %>
{dgettext("actions", "Move ammo")}
</.link>
<.link patch={~p"/ammo/show/add_shot_record/#{@pack}"} class="mx-4 my-2 btn btn-primary">
<%= dgettext("actions", "Record shots") %>
{dgettext("actions", "Record shots")}
</.link>
</div>
</div>
@ -91,12 +91,12 @@
<div>
<%= if @container do %>
<h1 class="px-4 py-2 mb-4 text-xl text-center rounded-lg title">
<%= gettext("Stored in") %>
{gettext("Stored in")}
</h1>
<.container_card container={@container} current_user={@current_user} />
<% else %>
<%= gettext("This ammo is not in a container") %>
{gettext("This ammo is not in a container")}
<% end %>
</div>
@ -104,7 +104,7 @@
<hr class="mb-4 w-full" />
<h1 class="px-4 py-2 mb-4 text-xl text-center rounded-lg title">
<%= gettext("Rounds used") %>
{gettext("Rounds used")}
</h1>
<.live_component