diff --git a/lib/cannery_web/components/ammo_group_card.ex b/lib/cannery_web/components/ammo_group_card.ex index 3686cdcb..25635acf 100644 --- a/lib/cannery_web/components/ammo_group_card.ex +++ b/lib/cannery_web/components/ammo_group_card.ex @@ -37,6 +37,11 @@ defmodule CanneryWeb.Components.AmmoGroupCard do <% end %> + + <%= gettext("Added on:") %> + <%= @ammo_group.inserted_at |> display_datetime() %> + + <%= if @ammo_group.price_paid do %> <%= gettext("Price paid:") %> diff --git a/lib/cannery_web/live/ammo_group_live/index.ex b/lib/cannery_web/live/ammo_group_live/index.ex index d4ee8142..3b5e3481 100644 --- a/lib/cannery_web/live/ammo_group_live/index.ex +++ b/lib/cannery_web/live/ammo_group_live/index.ex @@ -83,6 +83,7 @@ defmodule CanneryWeb.AmmoGroupLive.Index do %{label: gettext("% left"), key: "remaining"}, %{label: gettext("Range"), key: "range"}, %{label: gettext("Container"), key: "container"}, + %{label: gettext("Added on"), key: "added_on"}, %{label: nil, key: "actions", sortable: false} ] @@ -116,6 +117,15 @@ defmodule CanneryWeb.AmmoGroupLive.Index do 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("added_on", %{inserted_at: inserted_at}) do + assigns = %{inserted_at: inserted_at} + + {inserted_at, + ~H""" + <%= @inserted_at |> display_datetime() %> + """} + end + defp get_value_for_key("range", %{staged: staged} = ammo_group) do assigns = %{ammo_group: ammo_group} 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 0735babb..de64360f 100644 --- a/lib/cannery_web/live/ammo_group_live/show.html.heex +++ b/lib/cannery_web/live/ammo_group_live/show.html.heex @@ -26,6 +26,11 @@ <% end %> + + <%= gettext("Added on:") %> + <%= @ammo_group.inserted_at |> display_datetime() %> + + <%= if @ammo_group.price_paid do %> <%= gettext("Original cost:") %>