Show dates in european format
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
ee414c9440
commit
e6c5a58c65
6 changed files with 54 additions and 11 deletions
|
|
@ -23,6 +23,7 @@ defmodule MvWeb.MemberLive.Show do
|
|||
"""
|
||||
use MvWeb, :live_view
|
||||
import Ash.Query
|
||||
alias MvWeb.Helpers.DateFormatter
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
|
|
@ -52,8 +53,8 @@ defmodule MvWeb.MemberLive.Show do
|
|||
{if @member.paid, do: gettext("Yes"), else: gettext("No")}
|
||||
</:item>
|
||||
<:item title={gettext("Phone Number")}>{@member.phone_number}</:item>
|
||||
<:item title={gettext("Join Date")}>{@member.join_date}</:item>
|
||||
<:item title={gettext("Exit Date")}>{@member.exit_date}</:item>
|
||||
<:item title={gettext("Join Date")}>{DateFormatter.format_date(@member.join_date)}</:item>
|
||||
<:item title={gettext("Exit Date")}>{DateFormatter.format_date(@member.exit_date)}</:item>
|
||||
<:item title={gettext("Notes")}>{@member.notes}</:item>
|
||||
<:item title={gettext("City")}>{@member.city}</:item>
|
||||
<:item title={gettext("Street")}>{@member.street}</:item>
|
||||
|
|
@ -81,10 +82,7 @@ defmodule MvWeb.MemberLive.Show do
|
|||
# name
|
||||
cfv.custom_field && cfv.custom_field.name,
|
||||
# value
|
||||
case cfv.value do
|
||||
%{value: v} -> v
|
||||
v -> v
|
||||
end
|
||||
format_custom_field_value(cfv)
|
||||
}
|
||||
end)
|
||||
} />
|
||||
|
|
@ -114,4 +112,17 @@ defmodule MvWeb.MemberLive.Show do
|
|||
|
||||
defp page_title(:show), do: gettext("Show Member")
|
||||
defp page_title(:edit), do: gettext("Edit Member")
|
||||
|
||||
defp format_custom_field_value(cfv) do
|
||||
value =
|
||||
case cfv.value do
|
||||
%{value: v} -> v
|
||||
v -> v
|
||||
end
|
||||
|
||||
case value do
|
||||
%Date{} = date -> DateFormatter.format_date(date)
|
||||
other -> other
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue