This commit is contained in:
parent
6f88a635cc
commit
2ab3332941
2 changed files with 70 additions and 65 deletions
|
|
@ -64,65 +64,6 @@ defmodule Mv.Membership.Member do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attributes do
|
|
||||||
uuid_v7_primary_key :id
|
|
||||||
|
|
||||||
attribute :first_name, :string do
|
|
||||||
allow_nil? false
|
|
||||||
constraints min_length: 1
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :last_name, :string do
|
|
||||||
allow_nil? false
|
|
||||||
constraints min_length: 1
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :email, :string do
|
|
||||||
allow_nil? false
|
|
||||||
constraints min_length: 5, max_length: 254
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :birth_date, :date do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :paid, :boolean do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :phone_number, :string do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :join_date, :date do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :exit_date, :date do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :notes, :string do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :city, :string do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :street, :string do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :house_number, :string do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
|
|
||||||
attribute :postal_code, :string do
|
|
||||||
allow_nil? true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
validations do
|
validations do
|
||||||
# Required fields are covered by allow_nil? false
|
# Required fields are covered by allow_nil? false
|
||||||
|
|
||||||
|
|
@ -215,6 +156,65 @@ defmodule Mv.Membership.Member do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
attributes do
|
||||||
|
uuid_v7_primary_key :id
|
||||||
|
|
||||||
|
attribute :first_name, :string do
|
||||||
|
allow_nil? false
|
||||||
|
constraints min_length: 1
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :last_name, :string do
|
||||||
|
allow_nil? false
|
||||||
|
constraints min_length: 1
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :email, :string do
|
||||||
|
allow_nil? false
|
||||||
|
constraints min_length: 5, max_length: 254
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :birth_date, :date do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :paid, :boolean do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :phone_number, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :join_date, :date do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :exit_date, :date do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :notes, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :city, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :street, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :house_number, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :postal_code, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
relationships do
|
relationships do
|
||||||
has_many :properties, Mv.Membership.Property, destination_attribute: :member_id
|
has_many :properties, Mv.Membership.Property, destination_attribute: :member_id
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,19 @@ defmodule MvWeb.MemberLive.Show do
|
||||||
</.list>
|
</.list>
|
||||||
|
|
||||||
<h3 class="mt-8 mb-2 text-lg font-semibold">Custom Properties</h3>
|
<h3 class="mt-8 mb-2 text-lg font-semibold">Custom Properties</h3>
|
||||||
<.generic_list
|
<.generic_list items={
|
||||||
items={Enum.map(@member.properties, fn p ->
|
Enum.map(@member.properties, fn p ->
|
||||||
{
|
{
|
||||||
p.property_type && p.property_type.name, # name
|
# name
|
||||||
case p.value do %{value: v} -> v; v -> v end # value
|
p.property_type && p.property_type.name,
|
||||||
|
# value
|
||||||
|
case p.value do
|
||||||
|
%{value: v} -> v
|
||||||
|
v -> v
|
||||||
|
end
|
||||||
}
|
}
|
||||||
end)}
|
end)
|
||||||
/>
|
} />
|
||||||
<.back navigate={~p"/members"}>Back to members</.back>
|
<.back navigate={~p"/members"}>Back to members</.back>
|
||||||
|
|
||||||
<.modal
|
<.modal
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue