choose input filed type by value_type
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8d859275ba
commit
83d6b1173d
1 changed files with 7 additions and 1 deletions
|
|
@ -39,7 +39,13 @@ defmodule MvWeb.MemberLive.FormComponent do
|
||||||
<.inputs_for :let={f_property} field={@form[:properties]}>
|
<.inputs_for :let={f_property} field={@form[:properties]}>
|
||||||
<% type = Enum.find(@property_types, &(&1.id == f_property[:property_type_id].value)) %>
|
<% type = Enum.find(@property_types, &(&1.id == f_property[:property_type_id].value)) %>
|
||||||
<.inputs_for :let={value_form} field={f_property[:value]}>
|
<.inputs_for :let={value_form} field={f_property[:value]}>
|
||||||
<.input field={value_form[:value]} label={type && type.name} />
|
<% input_type =
|
||||||
|
cond do
|
||||||
|
type && type.value_type == :boolean -> "checkbox"
|
||||||
|
type && type.value_type == :date -> :date
|
||||||
|
true -> :text
|
||||||
|
end %>
|
||||||
|
<.input field={value_form[:value]} label={type && type.name} type={input_type} />
|
||||||
</.inputs_for>
|
</.inputs_for>
|
||||||
<input
|
<input
|
||||||
type="hidden"
|
type="hidden"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue