2023-10-17 11:17:22 +13:00
|
|
|
<.simple_form :let={f} for={@form} action={@action}>
|
|
|
|
<.error :if={@form.submitted_once?}>
|
|
|
|
Oops, something went wrong! Please check the errors below.
|
|
|
|
</.error>
|
2023-10-25 03:22:24 +13:00
|
|
|
<%%= if @form.type == :update do %>
|
|
|
|
<%= for attribute <- @update_attributes do %>
|
2023-10-17 11:17:22 +13:00
|
|
|
<%= if attribute.type in [Ash.Type.Integer] do %>
|
2023-10-25 03:22:24 +13:00
|
|
|
<.input field={f[:<%= attribute.name %>]} type="number" label="<%= Phoenix.Naming.humanize(attribute.name) %>" />
|
2023-10-17 11:17:22 +13:00
|
|
|
<% else %>
|
2023-10-25 08:44:15 +13:00
|
|
|
<.input field={f[:<%= attribute.name %>]} type="text" label="<%= Phoenix.Naming.humanize(attribute.name) %>" />
|
2023-10-17 11:17:22 +13:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2023-10-25 03:22:24 +13:00
|
|
|
<%% end %>
|
|
|
|
|
|
|
|
<%%= if @form.type == :create do %>
|
|
|
|
<%= for attribute <- @update_attributes do %>
|
|
|
|
<%= if attribute.type in [Ash.Type.Integer] do %>
|
|
|
|
<.input field={f[:<%= attribute.name %>]} type="number" label="<%= Phoenix.Naming.humanize(attribute.name) %>" />
|
|
|
|
<% else %>
|
|
|
|
<.input field={f[:<%= attribute.name %>]} type="text" label="<%= Phoenix.Naming.humanize(attribute.name) %>" />
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<%% end %>
|
2023-10-17 11:17:22 +13:00
|
|
|
<:actions>
|
|
|
|
<.button>Save Product</.button>
|
|
|
|
</:actions>
|
|
|
|
</.simple_form>
|