diff --git a/lib/mv_web/live/custom_field_live/form_component.ex b/lib/mv_web/live/custom_field_live/form_component.ex index 46be022..c0b731c 100644 --- a/lib/mv_web/live/custom_field_live/form_component.ex +++ b/lib/mv_web/live/custom_field_live/form_component.ex @@ -21,14 +21,9 @@ defmodule MvWeb.CustomFieldLive.FormComponent do ~H"""
-
- <.button type="button" phx-click="cancel" phx-target={@myself}> - <.icon name="hero-arrow-left" class="w-4 h-4" /> - -

- {if @custom_field, do: gettext("Edit Custom Field"), else: gettext("New Custom Field")} -

-
+

+ {if @custom_field, do: gettext("Edit Custom Field"), else: gettext("New Custom Field")} +

<.form for={@form} @@ -88,14 +83,7 @@ defmodule MvWeb.CustomFieldLive.FormComponent do def handle_event("save", %{"custom_field" => custom_field_params}, socket) do case AshPhoenix.Form.submit(socket.assigns.form, params: custom_field_params) do {:ok, custom_field} -> - action = - case socket.assigns.form.source.type do - :create -> gettext("create") - :update -> gettext("update") - other -> to_string(other) - end - - socket.assigns.on_save.(custom_field, action) + socket.assigns.on_save.(custom_field) {:noreply, socket} {:error, form} -> diff --git a/lib/mv_web/live/custom_field_live/index_component.ex b/lib/mv_web/live/custom_field_live/index_component.ex index 9b8ff0d..a071b7a 100644 --- a/lib/mv_web/live/custom_field_live/index_component.ex +++ b/lib/mv_web/live/custom_field_live/index_component.ex @@ -19,7 +19,7 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do <.header> {gettext("Custom Fields")} <:subtitle> - {gettext("These will appear in addition to other data when adding new members.")} + {gettext("Manage custom field definitions for members.")} <:actions> <.button variant="primary" phx-click="new_custom_field" phx-target={@myself}> @@ -34,14 +34,12 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do module={MvWeb.CustomFieldLive.FormComponent} id={@form_id} custom_field={@editing_custom_field} - on_save={fn custom_field, action -> send(self(), {:custom_field_saved, custom_field, action}) end} - on_cancel={fn -> send_update(__MODULE__, id: @id, show_form: false) end} + on_save={fn custom_field -> send(self(), {:custom_field_saved, custom_field}) end} + on_cancel={fn -> send(self(), :cancel_custom_field_form) end} />
- <%!-- Hide table when form is visible --%> <.table - :if={!@show_form} id="custom_fields" rows={@streams.custom_fields} row_click={ @@ -87,11 +85,11 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do <%!-- Delete Confirmation Modal --%>