- <.form_section title={gettext("Custom Fields")}>
-
-
{gettext("These will appear in addition to other data when adding new members.")}
-
- <.button class="ml-auto" variant="primary" phx-click="new_custom_field" phx-target={@myself}>
- <.icon name="hero-plus" /> {gettext("New Custom field")}
-
-
-
- <%!-- Show form when creating or editing --%>
-
- <.live_component
- 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}
- />
-
-
- <%!-- Hide table when form is visible --%>
- <.table
- :if={!@show_form}
- id="custom_fields"
- rows={@streams.custom_fields}
- row_click={
- fn {_id, custom_field} ->
- JS.push("edit_custom_field", value: %{id: custom_field.id}, target: @myself)
- end
- }
- >
- <:col :let={{_id, custom_field}} label={gettext("Name")}>{custom_field.name}
-
- <:col :let={{_id, custom_field}} label={gettext("Value Type")}>
- {@field_type_label.(custom_field.value_type)}
-
-
- <:col :let={{_id, custom_field}} label={gettext("Description")}>
- {custom_field.description}
-
-
- <:col :let={{_id, custom_field}} label={gettext("Show in overview")} class="max-w-[9.375rem] text-center">
-
- {gettext("Yes")}
-
-
- {gettext("No")}
-
-
-
- <:action :let={{_id, custom_field}}>
- <.icon_button
- icon="hero-pencil"
- label={gettext("Edit custom field")}
- size="sm"
- phx-click={JS.push("edit_custom_field", value: %{id: custom_field.id}, target: @myself)}
- />
-
-
- <:action :let={{_id, custom_field}}>
- <.icon_button
- icon="hero-trash"
- label={gettext("Delete custom field")}
- size="sm"
- class="btn-error"
- phx-click={JS.push("prepare_delete", value: %{id: custom_field.id}, target: @myself)}
- />
-
-
-
- <%!-- Delete Confirmation Modal --%>
-
-
-
{gettext("Delete Custom Field")}
-
-
-
- <.icon name="hero-exclamation-triangle" class="w-5 h-5" />
-
-
- {ngettext(
- "%{count} member has a value assigned for this custom field.",
- "%{count} members have values assigned for this custom field.",
- @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."
- )}
-
-
-
-
-
-
-
- {gettext("To confirm deletion, please enter this text:")}
-
-
-
- {@custom_field_to_delete.slug}
-
-
-
-
-
-
-
- {gettext("Cancel")}
-
-
+
+
+ {gettext("These will appear in addition to other data when adding new members.")}
+
+
+ <.button
+ class="ml-auto"
+ variant="primary"
+ phx-click="new_custom_field"
phx-target={@myself}
- class="btn btn-error"
- disabled={@slug_confirmation != @custom_field_to_delete.slug}
>
- {gettext("Delete Custom Field and All Values")}
-
+ <.icon name="hero-plus" /> {gettext("New Custom field")}
+
+ <%!-- Show form when creating or editing --%>
+
+ <.live_component
+ 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}
+ />
+
+
+ <%!-- Hide table when form is visible --%>
+ <.table
+ :if={!@show_form}
+ id="custom_fields"
+ rows={@streams.custom_fields}
+ row_click={
+ fn {_id, custom_field} ->
+ JS.push("edit_custom_field", value: %{id: custom_field.id}, target: @myself)
+ end
+ }
+ >
+ <:col :let={{_id, custom_field}} label={gettext("Name")}>{custom_field.name}
+
+ <:col :let={{_id, custom_field}} label={gettext("Value Type")}>
+ {@field_type_label.(custom_field.value_type)}
+
+
+ <:col :let={{_id, custom_field}} label={gettext("Description")}>
+ {custom_field.description}
+
+
+ <:col
+ :let={{_id, custom_field}}
+ label={gettext("Show in overview")}
+ class="max-w-[9.375rem] text-center"
+ >
+
+ {gettext("Yes")}
+
+
+ {gettext("No")}
+
+
+
+ <:action :let={{_id, custom_field}}>
+ <.link phx-click={
+ JS.push("edit_custom_field", value: %{id: custom_field.id}, target: @myself)
+ }>
+ {gettext("Edit")}
+
+
+
+ <:action :let={{_id, custom_field}}>
+ <.link phx-click={
+ JS.push("prepare_delete", value: %{id: custom_field.id}, target: @myself)
+ }>
+ {gettext("Delete")}
+
+
+
+
+ <%!-- Delete Confirmation Modal --%>
+
+
+
{gettext("Delete Custom Field")}
+
+
+
+ <.icon name="hero-exclamation-triangle" class="w-5 h-5" />
+
+
+ {ngettext(
+ "%{count} member has a value assigned for this custom field.",
+ "%{count} members have values assigned for this custom field.",
+ @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."
+ )}
+
+
+
+
+
+
+
+ {gettext("To confirm deletion, please enter this text:")}
+
+
+
+ {@custom_field_to_delete.slug}
+
+
+
+
+
+
+
+ {gettext("Cancel")}
+
+
+ {gettext("Delete Custom Field and All Values")}
+
+
+
diff --git a/lib/mv_web/live/global_settings_live.ex b/lib/mv_web/live/global_settings_live.ex
index bb919cb..0b3ec1c 100644
--- a/lib/mv_web/live/global_settings_live.ex
+++ b/lib/mv_web/live/global_settings_live.ex
@@ -46,22 +46,22 @@ defmodule MvWeb.GlobalSettingsLive do
<%!-- Club Settings Section --%>
- <.header>
- {gettext("Club Settings")}
-
- <.form for={@form} id="settings-form" phx-change="validate" phx-submit="save">
- <.input
- field={@form[:club_name]}
- type="text"
- label={gettext("Association Name")}
- required
- />
-
- <.button phx-disable-with={gettext("Saving...")} variant="primary">
- {gettext("Save Settings")}
-
-
+ <.form_section title={gettext("Club Settings")}>
+ <.form for={@form} id="settings-form" phx-change="validate" phx-submit="save">
+
+ <.input
+ field={@form[:club_name]}
+ type="text"
+ label={gettext("Association Name")}
+ required
+ />
+
+ <.button phx-disable-with={gettext("Saving...")} variant="primary">
+ {gettext("Save Settings")}
+
+
+
<%!-- Custom Fields Section --%>
<.live_component
module={MvWeb.CustomFieldLive.IndexComponent}
diff --git a/lib/mv_web/live/member_live/form.ex b/lib/mv_web/live/member_live/form.ex
index 5380d0f..87148ad 100644
--- a/lib/mv_web/live/member_live/form.ex
+++ b/lib/mv_web/live/member_live/form.ex
@@ -348,25 +348,6 @@ defmodule MvWeb.MemberLive.Form do
defp return_path("show", nil), do: ~p"/members"
defp return_path("show", member), do: ~p"/members/#{member.id}"
- # -----------------------------------------------------------------
- # Helper Components
- # -----------------------------------------------------------------
-
- # Renders a form section box with border and title.
- attr :title, :string, required: true
- slot :inner_block, required: true
-
- defp form_section(assigns) do
- ~H"""
-
- {@title}
-
- {render_slot(@inner_block)}
-
-
- """
- end
-
# -----------------------------------------------------------------
# Helper Functions for Custom Fields
# -----------------------------------------------------------------