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 b15e49d..c4002bc 100644 --- a/lib/mv_web/live/custom_field_live/index_component.ex +++ b/lib/mv_web/live/custom_field_live/index_component.ex @@ -19,8 +19,8 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do assigns = assign(assigns, :field_type_label, &MvWeb.Translations.FieldTypes.label/1) ~H""" -
{gettext("These will appear in addition to other data when adding new members.")}
@@ -118,15 +118,15 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do{ngettext( - "%{count} member has a value assigned for this custom field.", - "%{count} members have values assigned for this custom field.", + "%{count} member has a value assigned for this datafield.", + "%{count} members have values assigned for this datafield.", @custom_field_to_delete.assigned_members_count, count: @custom_field_to_delete.assigned_members_count )}
{gettext( - "All custom field values will be permanently deleted when you delete this custom field." + "All datafield values will be permanently deleted when you delete this datfield." )}
+
{gettext( "These fields are neccessary for MILA to handle member identification and payment calculations in the future. Thus you cannot delete these fields but hide them in the member overview." )} @@ -100,8 +100,8 @@ defmodule MvWeb.MemberFieldLive.IndexComponent do @impl true def update(assigns, socket) do - # Track previous show_form state to detect when form is closed - previous_show_form = Map.get(socket.assigns, :show_form, false) + # Use socket state so send_update(show_form: false) is the only trigger for "form closed" + previous_show_form = socket.assigns[:show_form] || false # If show_form is explicitly provided in assigns, reset editing state socket = @@ -113,20 +113,22 @@ defmodule MvWeb.MemberFieldLive.IndexComponent do socket end - # Detect when form is closed (show_form changes from true to false) - new_show_form = Map.get(assigns, :show_form, false) + socket = + socket + |> assign(assigns) + |> assign_new(:settings, fn -> get_settings() end) + |> assign_new(:show_form, fn -> false end) + |> assign_new(:form_id, fn -> "member-field-form-new" end) + |> assign_new(:editing_member_field, fn -> nil end) - if previous_show_form and not new_show_form do + # Detect form closed only from final socket state (not from assigns alone) + current_show_form = socket.assigns[:show_form] || false + + if previous_show_form and not current_show_form do send(self(), {:editing_section_changed, nil}) end - {:ok, - socket - |> assign(assigns) - |> assign_new(:settings, fn -> get_settings() end) - |> assign_new(:show_form, fn -> false end) - |> assign_new(:form_id, fn -> "member-field-form-new" end) - |> assign_new(:editing_member_field, fn -> nil end)} + {:ok, socket} end @impl true diff --git a/lib/mv_web/live/user_live/form.ex b/lib/mv_web/live/user_live/form.ex index 4934e3a..0cd898f 100644 --- a/lib/mv_web/live/user_live/form.ex +++ b/lib/mv_web/live/user_live/form.ex @@ -79,7 +79,7 @@ defmodule MvWeb.UserLive.Form do />