From 4154296b54bb4bab95e661b468e2a41b0741bee4 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 20 Jan 2026 15:38:09 +0100 Subject: [PATCH] refactor: Remove deprecated LiveViews - Remove CustomFieldValueLive (Index, Form, Show) - Remove ContributionTypeLive.Index - Remove ContributionPeriodLive.Show - Remove corresponding routes from router - Remove references in CustomFieldValueLive.Index --- .../live/contribution_period_live/show.ex | 345 ------------------ .../live/contribution_type_live/index.ex | 205 ----------- .../live/custom_field_value_live/form.ex | 300 --------------- .../live/custom_field_value_live/index.ex | 157 -------- .../live/custom_field_value_live/show.ex | 67 ---- lib/mv_web/router.ex | 10 - test/mv_web/live/profile_navigation_test.exs | 2 - 7 files changed, 1086 deletions(-) delete mode 100644 lib/mv_web/live/contribution_period_live/show.ex delete mode 100644 lib/mv_web/live/contribution_type_live/index.ex delete mode 100644 lib/mv_web/live/custom_field_value_live/form.ex delete mode 100644 lib/mv_web/live/custom_field_value_live/index.ex delete mode 100644 lib/mv_web/live/custom_field_value_live/show.ex diff --git a/lib/mv_web/live/contribution_period_live/show.ex b/lib/mv_web/live/contribution_period_live/show.ex deleted file mode 100644 index b6a2574..0000000 --- a/lib/mv_web/live/contribution_period_live/show.ex +++ /dev/null @@ -1,345 +0,0 @@ -defmodule MvWeb.ContributionPeriodLive.Show do - @moduledoc """ - Mock-up LiveView for Member Contribution Periods (Admin/Treasurer View). - - This is a preview-only page that displays the planned UI for viewing - and managing contribution periods for a specific member. - It shows static mock data and is not functional. - - ## Planned Features (Future Implementation) - - Display all contribution periods for a member - - Show period dates, interval, amount, and status - - Quick status change (paid/unpaid/suspended) - - Bulk marking of multiple periods - - Notes per period - - ## Note - This page is intentionally non-functional and serves as a UI mockup - for the upcoming Membership Contributions feature. - """ - use MvWeb, :live_view - - @impl true - def mount(_params, _session, socket) do - {:ok, - socket - |> assign(:page_title, gettext("Member Contributions")) - |> assign(:member, mock_member()) - |> assign(:periods, mock_periods()) - |> assign(:selected_periods, MapSet.new())} - end - - @impl true - def render(assigns) do - ~H""" - - <.mockup_warning /> - - <.header> - {gettext("Contributions for %{name}", name: MvWeb.Helpers.MemberHelpers.display_name(@member))} - <:subtitle> - {gettext("Contribution type")}: - {@member.contribution_type} - · {gettext("Member since")}: {@member.joined_at} - - <:actions> - <.link navigate={~p"/membership_fee_settings"} class="btn btn-ghost btn-sm"> - <.icon name="hero-arrow-left" class="size-4" /> - {gettext("Back to Settings")} - - - - - <%!-- Member Info Card --%> -
-
-
-
- {gettext("Email")} -

{@member.email}

-
-
- {gettext("Contribution Start")} -

{@member.contribution_start}

-
-
- {gettext("Total Contributions")} -

{length(@periods)}

-
-
- {gettext("Open Contributions")} -

- {Enum.count(@periods, &(&1.status == :unpaid))} -

-
-
-
-
- - <%!-- Contribution Type Change --%> -
-
-
- {gettext("Change Contribution Type")}: - - - <.icon name="hero-question-mark-circle" class="inline size-4" /> - {gettext("Why are not all contribution types shown?")} - -
-
-
- - <%!-- Bulk Actions --%> -
- - {ngettext( - "%{count} period selected", - "%{count} periods selected", - MapSet.size(@selected_periods), - count: MapSet.size(@selected_periods) - )} - - - - -
- - <%!-- Periods Table --%> -
- - - - - - - - - - - - - - - - - - - - - - - -
- - {gettext("Time Period")}{gettext("Interval")}{gettext("Amount")}{gettext("Status")}{gettext("Notes")}{gettext("Actions")}
- - -
- {period.period_start} – {period.period_end} -
-
- {gettext("Current")} -
-
- {format_interval(period.interval)} - - {format_currency(period.amount)} - - <.status_badge status={period.status} /> - - - {period.notes} - - - -
- <.link - href="#" - class={[ - "cursor-not-allowed", - if(period.status == :paid, do: "invisible", else: "opacity-50") - ]} - > - {gettext("Paid")} - - <.link - href="#" - class={[ - "cursor-not-allowed", - if(period.status == :suspended, do: "invisible", else: "opacity-50") - ]} - > - {gettext("Suspend")} - - <.link - href="#" - class={[ - "cursor-not-allowed", - if(period.status != :paid, do: "invisible", else: "opacity-50") - ]} - > - {gettext("Reopen")} - - <.link href="#" class="opacity-50 cursor-not-allowed"> - {gettext("Note")} - -
-
-
-
- """ - end - - # Mock-up warning banner component - subtle orange style - defp mockup_warning(assigns) do - ~H""" -
- <.icon name="hero-exclamation-triangle" class="size-5 shrink-0" /> -
- {gettext("Preview Mockup")} - - – {gettext("This page is not functional and only displays the planned features.")} - -
-
- """ - end - - # Status badge component - attr :status, :atom, required: true - - defp status_badge(%{status: :paid} = assigns) do - ~H""" - - <.icon name="hero-check-circle-mini" class="size-3" /> - {gettext("Paid")} - - """ - end - - defp status_badge(%{status: :unpaid} = assigns) do - ~H""" - - <.icon name="hero-x-circle-mini" class="size-3" /> - {gettext("Unpaid")} - - """ - end - - defp status_badge(%{status: :suspended} = assigns) do - ~H""" - - <.icon name="hero-pause-circle-mini" class="size-3" /> - {gettext("Suspended")} - - """ - end - - defp period_row_class(:unpaid), do: "bg-error/5" - defp period_row_class(:suspended), do: "bg-base-200/50" - defp period_row_class(_), do: "" - - # Mock member data - defp mock_member do - %{ - id: "123", - first_name: "Maria", - last_name: "Weber", - email: "maria.weber@example.de", - contribution_type: gettext("Regular"), - joined_at: "15.03.2021", - contribution_start: "01.01.2021" - } - end - - # Mock periods data - defp mock_periods do - [ - %{ - id: "p1", - period_start: "01.01.2025", - period_end: "31.12.2025", - interval: :yearly, - amount: Decimal.new("60.00"), - status: :unpaid, - notes: nil, - is_current: true - }, - %{ - id: "p2", - period_start: "01.01.2024", - period_end: "31.12.2024", - interval: :yearly, - amount: Decimal.new("60.00"), - status: :paid, - notes: gettext("Paid via bank transfer"), - is_current: false - }, - %{ - id: "p3", - period_start: "01.01.2023", - period_end: "31.12.2023", - interval: :yearly, - amount: Decimal.new("50.00"), - status: :paid, - notes: nil, - is_current: false - }, - %{ - id: "p4", - period_start: "01.01.2022", - period_end: "31.12.2022", - interval: :yearly, - amount: Decimal.new("50.00"), - status: :paid, - notes: nil, - is_current: false - }, - %{ - id: "p5", - period_start: "01.01.2021", - period_end: "31.12.2021", - interval: :yearly, - amount: Decimal.new("50.00"), - status: :suspended, - notes: gettext("Joining year - reduced to 0"), - is_current: false - } - ] - end - - defp format_currency(%Decimal{} = amount) do - "#{Decimal.to_string(amount)} €" - end - - defp format_interval(:monthly), do: gettext("Monthly") - defp format_interval(:quarterly), do: gettext("Quarterly") - defp format_interval(:half_yearly), do: gettext("Half-yearly") - defp format_interval(:yearly), do: gettext("Yearly") -end diff --git a/lib/mv_web/live/contribution_type_live/index.ex b/lib/mv_web/live/contribution_type_live/index.ex deleted file mode 100644 index 3e2f04c..0000000 --- a/lib/mv_web/live/contribution_type_live/index.ex +++ /dev/null @@ -1,205 +0,0 @@ -defmodule MvWeb.ContributionTypeLive.Index do - @moduledoc """ - Mock-up LiveView for Contribution Types Management (Admin). - - This is a preview-only page that displays the planned UI for managing - contribution types. It shows static mock data and is not functional. - - ## Planned Features (Future Implementation) - - List all contribution types - - Display: Name, Amount, Interval, Member count - - Create new contribution types - - Edit existing contribution types (name, amount, description - NOT interval) - - Delete contribution types (if no members assigned) - - ## Note - This page is intentionally non-functional and serves as a UI mockup - for the upcoming Membership Contributions feature. - """ - use MvWeb, :live_view - - @impl true - def mount(_params, _session, socket) do - {:ok, - socket - |> assign(:page_title, gettext("Contribution Types")) - |> assign(:contribution_types, mock_contribution_types())} - end - - @impl true - def render(assigns) do - ~H""" - - <.mockup_warning /> - - <.header> - {gettext("Contribution Types")} - <:subtitle> - {gettext("Manage contribution types for membership fees.")} - - <:actions> - - - - - <.table id="contribution_types" rows={@contribution_types} row_id={fn ct -> "ct-#{ct.id}" end}> - <:col :let={ct} label={gettext("Name")}> - {ct.name} -

{ct.description}

- - - <:col :let={ct} label={gettext("Amount")}> - {format_currency(ct.amount)} - - - <:col :let={ct} label={gettext("Interval")}> - {format_interval(ct.interval)} - - - <:col :let={ct} label={gettext("Members")}> - {ct.member_count} - - - <:action :let={_ct}> - - - - <:action :let={ct}> - - - - - <.info_card /> -
- """ - end - - # Mock-up warning banner component - subtle orange style - defp mockup_warning(assigns) do - ~H""" -
- <.icon name="hero-exclamation-triangle" class="size-5 shrink-0" /> -
- {gettext("Preview Mockup")} - - – {gettext("This page is not functional and only displays the planned features.")} - -
-
- """ - end - - # Info card explaining the contribution type concept - defp info_card(assigns) do - ~H""" -
-
-

- <.icon name="hero-information-circle" class="size-5" /> - {gettext("About Contribution Types")} -

-
-

- {gettext( - "Contribution types define different membership fee structures. Each type has a fixed cycle (monthly, quarterly, half-yearly, yearly) that cannot be changed after creation." - )} -

-
    -
  • - {gettext("Name & Amount")} - - {gettext("Can be changed at any time. Amount changes affect future periods only.")} -
  • -
  • - {gettext("Interval")} - - {gettext( - "Fixed after creation. Members can only switch between types with the same interval." - )} -
  • -
  • - {gettext("Deletion")} - - {gettext("Only possible if no members are assigned to this type.")} -
  • -
-
-
-
- """ - end - - # Mock data for demonstration - defp mock_contribution_types do - [ - %{ - id: "1", - name: gettext("Regular"), - description: gettext("Standard membership fee for regular members"), - amount: Decimal.new("60.00"), - interval: :yearly, - member_count: 45 - }, - %{ - id: "2", - name: gettext("Reduced"), - description: gettext("Reduced fee for unemployed, pensioners, or low income"), - amount: Decimal.new("30.00"), - interval: :yearly, - member_count: 12 - }, - %{ - id: "3", - name: gettext("Student"), - description: gettext("Monthly fee for students and trainees"), - amount: Decimal.new("5.00"), - interval: :monthly, - member_count: 8 - }, - %{ - id: "4", - name: gettext("Family"), - description: gettext("Quarterly fee for family memberships"), - amount: Decimal.new("25.00"), - interval: :quarterly, - member_count: 15 - }, - %{ - id: "5", - name: gettext("Supporting Member"), - description: gettext("Half-yearly contribution for supporting members"), - amount: Decimal.new("100.00"), - interval: :half_yearly, - member_count: 3 - }, - %{ - id: "6", - name: gettext("Honorary"), - description: gettext("No fee for honorary members"), - amount: Decimal.new("0.00"), - interval: :yearly, - member_count: 2 - } - ] - end - - defp format_currency(%Decimal{} = amount) do - "#{Decimal.to_string(amount)} €" - end - - defp format_interval(:monthly), do: gettext("Monthly") - defp format_interval(:quarterly), do: gettext("Quarterly") - defp format_interval(:half_yearly), do: gettext("Half-yearly") - defp format_interval(:yearly), do: gettext("Yearly") -end diff --git a/lib/mv_web/live/custom_field_value_live/form.ex b/lib/mv_web/live/custom_field_value_live/form.ex deleted file mode 100644 index 599ce1d..0000000 --- a/lib/mv_web/live/custom_field_value_live/form.ex +++ /dev/null @@ -1,300 +0,0 @@ -defmodule MvWeb.CustomFieldValueLive.Form do - @moduledoc """ - LiveView form for creating and editing custom field values. - - ## Features - - Create new custom field values with member and type selection - - Edit existing custom field values - - Value input adapts to custom field type (string, integer, boolean, date, email) - - Real-time validation - - ## Form Fields - **Required:** - - member - Select which member owns this custom field value - - custom_field - Select the type (defines value type) - - value - The actual value (input type depends on custom field type) - - ## Value Types - The form dynamically renders appropriate inputs based on custom field type: - - String: text input - - Integer: number input - - Boolean: checkbox - - Date: date picker - - Email: email input with validation - - ## Events - - `validate` - Real-time form validation - - `save` - Submit form (create or update custom field value) - - ## Note - Custom field values are typically managed through the member edit form, - not through this standalone form. - """ - use MvWeb, :live_view - - on_mount {MvWeb.LiveHelpers, :ensure_user_role_loaded} - import MvWeb.LiveHelpers, only: [current_actor: 1, submit_form: 3] - - @impl true - def render(assigns) do - ~H""" - - <.header> - {@page_title} - <:subtitle> - {gettext("Use this form to manage Custom Field Value records in your database.")} - - - - <.form for={@form} id="custom_field_value-form" phx-change="validate" phx-submit="save"> - - <.input - field={@form[:custom_field_id]} - type="select" - label={gettext("Custom field")} - options={custom_field_options(@custom_fields)} - prompt={gettext("Choose a custom field")} - /> - - - <.input - field={@form[:member_id]} - type="select" - label={gettext("Member")} - options={member_options(@members)} - prompt={gettext("Choose a member")} - /> - - - <%= if @selected_custom_field do %> - <.union_value_input form={@form} custom_field={@selected_custom_field} /> - <% else %> -
- {gettext("Please select a custom field first")} -
- <% end %> - - <.button phx-disable-with={gettext("Saving...")} variant="primary"> - {gettext("Save Custom Field Value")} - - <.button navigate={return_path(@return_to, @custom_field_value)}>{gettext("Cancel")} - -
- """ - end - - # Helper function for Union-Value Input - defp union_value_input(assigns) do - # Extract the current value from the CustomFieldValue - current_value = extract_current_value(assigns.form.data, assigns.custom_field.value_type) - assigns = assign(assigns, :current_value, current_value) - - ~H""" -
- - - <%= case @custom_field.value_type do %> - <% :string -> %> - <.inputs_for :let={value_form} field={@form[:value]}> - <.input field={value_form[:value]} type="text" label="" value={@current_value} /> - - - <% :integer -> %> - <.inputs_for :let={value_form} field={@form[:value]}> - <.input field={value_form[:value]} type="number" label="" value={@current_value} /> - - - <% :boolean -> %> - <.inputs_for :let={value_form} field={@form[:value]}> - <.input field={value_form[:value]} type="checkbox" label="" checked={@current_value} /> - - - <% :date -> %> - <.inputs_for :let={value_form} field={@form[:value]}> - <.input - field={value_form[:value]} - type="date" - label="" - value={format_date_value(@current_value)} - /> - - - <% :email -> %> - <.inputs_for :let={value_form} field={@form[:value]}> - <.input field={value_form[:value]} type="email" label="" value={@current_value} /> - - - <% _ -> %> -
- {gettext("Unsupported value type: %{type}", type: @custom_field.value_type)} -
- <% end %> -
- """ - end - - # Helper function to extract the current value from the CustomFieldValue - defp extract_current_value( - %Mv.Membership.CustomFieldValue{value: %Ash.Union{value: value}}, - _value_type - ) do - value - end - - defp extract_current_value(_data, _value_type) do - nil - end - - # Helper function to format Date values for HTML input - defp format_date_value(%Date{} = date) do - Date.to_iso8601(date) - end - - defp format_date_value(nil), do: "" - - defp format_date_value(date) when is_binary(date) do - case Date.from_iso8601(date) do - {:ok, parsed_date} -> Date.to_iso8601(parsed_date) - _ -> "" - end - end - - defp format_date_value(_), do: "" - - @impl true - def mount(params, _session, socket) do - custom_field_value = - case params["id"] do - nil -> nil - id -> Ash.get!(Mv.Membership.CustomFieldValue, id) |> Ash.load!([:custom_field]) - end - - action = if is_nil(custom_field_value), do: "New", else: "Edit" - page_title = action <> " " <> "Custom field value" - - # Load all CustomFields and Members for the selection fields - actor = current_actor(socket) - custom_fields = Ash.read!(Mv.Membership.CustomField, actor: actor) - members = Ash.read!(Mv.Membership.Member, actor: actor) - - {:ok, - socket - |> assign(:return_to, return_to(params["return_to"])) - |> assign(custom_field_value: custom_field_value) - |> assign(:page_title, page_title) - |> assign(:custom_fields, custom_fields) - |> assign(:members, members) - |> assign(:selected_custom_field, custom_field_value && custom_field_value.custom_field) - |> assign_form()} - end - - defp return_to("show"), do: "show" - defp return_to(_), do: "index" - - @impl true - def handle_event("validate", %{"custom_field_value" => custom_field_value_params}, socket) do - # Find the selected CustomField - selected_custom_field = - case custom_field_value_params["custom_field_id"] do - "" -> nil - nil -> nil - id -> Enum.find(socket.assigns.custom_fields, &(&1.id == id)) - end - - # Set the Union type based on the selected CustomField - updated_params = - if selected_custom_field do - union_type = to_string(selected_custom_field.value_type) - put_in(custom_field_value_params, ["value", "_union_type"], union_type) - else - custom_field_value_params - end - - {:noreply, - socket - |> assign(:selected_custom_field, selected_custom_field) - |> assign(form: AshPhoenix.Form.validate(socket.assigns.form, updated_params))} - end - - def handle_event("save", %{"custom_field_value" => custom_field_value_params}, socket) do - # Set the Union type based on the selected CustomField - updated_params = - if socket.assigns.selected_custom_field do - union_type = to_string(socket.assigns.selected_custom_field.value_type) - put_in(custom_field_value_params, ["value", "_union_type"], union_type) - else - custom_field_value_params - end - - actor = current_actor(socket) - - case submit_form(socket.assigns.form, updated_params, actor) do - {:ok, custom_field_value} -> - notify_parent({:saved, custom_field_value}) - - action = - case socket.assigns.form.source.type do - :create -> gettext("create") - :update -> gettext("update") - other -> to_string(other) - end - - socket = - socket - |> put_flash( - :info, - gettext("Custom field value %{action} successfully", action: action) - ) - |> push_navigate(to: return_path(socket.assigns.return_to, custom_field_value)) - - {:noreply, socket} - - {:error, form} -> - {:noreply, assign(socket, form: form)} - end - end - - defp notify_parent(msg), do: send(self(), {__MODULE__, msg}) - - defp assign_form(%{assigns: %{custom_field_value: custom_field_value}} = socket) do - form = - if custom_field_value do - # Determine the Union type based on the custom_field - union_type = custom_field_value.custom_field && custom_field_value.custom_field.value_type - - params = - if union_type do - %{"value" => %{"_union_type" => to_string(union_type)}} - else - %{} - end - - AshPhoenix.Form.for_update(custom_field_value, :update, - as: "custom_field_value", - params: params - ) - else - AshPhoenix.Form.for_create(Mv.Membership.CustomFieldValue, :create, - as: "custom_field_value" - ) - end - - assign(socket, form: to_form(form)) - end - - defp return_path("index", _custom_field_value), do: ~p"/custom_field_values" - - defp return_path("show", custom_field_value), - do: ~p"/custom_field_values/#{custom_field_value.id}" - - # Helper functions for selection options - defp custom_field_options(custom_fields) do - Enum.map(custom_fields, &{&1.name, &1.id}) - end - - defp member_options(members) do - Enum.map(members, &{MvWeb.Helpers.MemberHelpers.display_name(&1), &1.id}) - end -end diff --git a/lib/mv_web/live/custom_field_value_live/index.ex b/lib/mv_web/live/custom_field_value_live/index.ex deleted file mode 100644 index eea578e..0000000 --- a/lib/mv_web/live/custom_field_value_live/index.ex +++ /dev/null @@ -1,157 +0,0 @@ -defmodule MvWeb.CustomFieldValueLive.Index do - @moduledoc """ - LiveView for displaying and managing custom field values. - - ## Features - - List all custom field values with their values and types - - Show which member each custom field value belongs to - - Display custom field information - - Navigate to custom field value details and edit forms - - Delete custom field values - - ## Relationships - Each custom field value is linked to: - - A member (the custom field value owner) - - A custom field (defining value type and behavior) - - ## Events - - `delete` - Remove a custom field value from the database - - ## Note - Custom field values are typically managed through the member edit form. - This view provides a global overview of all custom field values. - """ - use MvWeb, :live_view - - on_mount {MvWeb.LiveHelpers, :ensure_user_role_loaded} - import MvWeb.LiveHelpers, only: [current_actor: 1] - - @impl true - def render(assigns) do - ~H""" - - <.header> - Listing Custom field values - <:actions> - <.button variant="primary" navigate={~p"/custom_field_values/new"}> - <.icon name="hero-plus" /> New Custom field value - - - - - <.table - id="custom_field_values" - rows={@streams.custom_field_values} - row_click={ - fn {_id, custom_field_value} -> - JS.navigate(~p"/custom_field_values/#{custom_field_value}") - end - } - > - <:col :let={{_id, custom_field_value}} label="Id">{custom_field_value.id} - - <:action :let={{_id, custom_field_value}}> -
- <.link navigate={~p"/custom_field_values/#{custom_field_value}"}>Show -
- - <.link navigate={~p"/custom_field_values/#{custom_field_value}/edit"}>Edit - - - <:action :let={{id, custom_field_value}}> - <.link - phx-click={JS.push("delete", value: %{id: custom_field_value.id}) |> hide("##{id}")} - data-confirm="Are you sure?" - > - Delete - - - -
- """ - end - - @impl true - def mount(_params, _session, socket) do - actor = current_actor(socket) - - # Early return if no actor (prevents exceptions in unauthenticated tests) - if is_nil(actor) do - {:ok, - socket - |> assign(:page_title, "Listing Custom field values") - |> stream(:custom_field_values, [])} - else - case Ash.read(Mv.Membership.CustomFieldValue, actor: actor) do - {:ok, custom_field_values} -> - {:ok, - socket - |> assign(:page_title, "Listing Custom field values") - |> stream(:custom_field_values, custom_field_values)} - - {:error, %Ash.Error.Forbidden{}} -> - {:ok, - socket - |> assign(:page_title, "Listing Custom field values") - |> stream(:custom_field_values, []) - |> put_flash(:error, gettext("You do not have permission to view custom field values"))} - - {:error, error} -> - {:ok, - socket - |> assign(:page_title, "Listing Custom field values") - |> stream(:custom_field_values, []) - |> put_flash(:error, format_error(error))} - end - end - end - - @impl true - def handle_event("delete", %{"id" => id}, socket) do - actor = MvWeb.LiveHelpers.current_actor(socket) - - case Ash.get(Mv.Membership.CustomFieldValue, id, actor: actor) do - {:ok, custom_field_value} -> - case Ash.destroy(custom_field_value, actor: actor) do - :ok -> - {:noreply, - socket - |> stream_delete(:custom_field_values, custom_field_value) - |> put_flash(:info, gettext("Custom field value deleted successfully"))} - - {:error, %Ash.Error.Forbidden{}} -> - {:noreply, - put_flash( - socket, - :error, - gettext("You do not have permission to delete this custom field value") - )} - - {:error, error} -> - {:noreply, put_flash(socket, :error, format_error(error))} - end - - {:error, %Ash.Error.Query.NotFound{}} -> - {:noreply, put_flash(socket, :error, gettext("Custom field value not found"))} - - {:error, %Ash.Error.Forbidden{} = _error} -> - {:noreply, - put_flash( - socket, - :error, - gettext("You do not have permission to access this custom field value") - )} - - {:error, error} -> - {:noreply, put_flash(socket, :error, format_error(error))} - end - end - - defp format_error(%Ash.Error.Invalid{errors: errors}) do - Enum.map_join(errors, ", ", fn %{message: message} -> message end) - end - - defp format_error(error) do - inspect(error) - end -end diff --git a/lib/mv_web/live/custom_field_value_live/show.ex b/lib/mv_web/live/custom_field_value_live/show.ex deleted file mode 100644 index 7a3f678..0000000 --- a/lib/mv_web/live/custom_field_value_live/show.ex +++ /dev/null @@ -1,67 +0,0 @@ -defmodule MvWeb.CustomFieldValueLive.Show do - @moduledoc """ - LiveView for displaying a single custom field value's details. - - ## Features - - Display custom field value and type - - Show linked member - - Show custom field definition - - Navigate to edit form - - Return to custom field value list - - ## Displayed Information - - Custom field value (formatted based on type) - - Custom field name and description - - Member information (who owns this custom field value) - - Custom field value metadata (ID, timestamps if added) - - ## Navigation - - Back to custom field value list - - Edit custom field value - """ - use MvWeb, :live_view - - @impl true - def render(assigns) do - ~H""" - - <.header> - Data field value {@custom_field_value.id} - <:subtitle>This is a custom_field_value record from your database. - - <:actions> - <.button navigate={~p"/custom_field_values"}> - <.icon name="hero-arrow-left" /> - - <.button - variant="primary" - navigate={~p"/custom_field_values/#{@custom_field_value}/edit?return_to=show"} - > - <.icon name="hero-pencil-square" /> Edit Custom field value - - - - - <.list> - <:item title="Id">{@custom_field_value.id} - - - """ - end - - @impl true - def mount(_params, _session, socket) do - {:ok, socket} - end - - @impl true - def handle_params(%{"id" => id}, _, socket) do - {:noreply, - socket - |> assign(:page_title, page_title(socket.assigns.live_action)) - |> assign(:custom_field_value, Ash.get!(Mv.Membership.CustomFieldValue, id))} - end - - defp page_title(:show), do: "Show data field value" - defp page_title(:edit), do: "Edit data field value" -end diff --git a/lib/mv_web/router.ex b/lib/mv_web/router.ex index 682b672..79f4791 100644 --- a/lib/mv_web/router.ex +++ b/lib/mv_web/router.ex @@ -58,12 +58,6 @@ defmodule MvWeb.Router do live "/members/:id", MemberLive.Show, :show live "/members/:id/show/edit", MemberLive.Show, :edit - live "/custom_field_values", CustomFieldValueLive.Index, :index - live "/custom_field_values/new", CustomFieldValueLive.Form, :new - live "/custom_field_values/:id/edit", CustomFieldValueLive.Form, :edit - live "/custom_field_values/:id", CustomFieldValueLive.Show, :show - live "/custom_field_values/:id/show/edit", CustomFieldValueLive.Show, :edit - live "/users", UserLive.Index, :index live "/users/new", UserLive.Form, :new live "/users/:id/edit", UserLive.Form, :edit @@ -80,10 +74,6 @@ defmodule MvWeb.Router do live "/membership_fee_types/new", MembershipFeeTypeLive.Form, :new live "/membership_fee_types/:id/edit", MembershipFeeTypeLive.Form, :edit - # Contribution Management (Mock-ups) - live "/contribution_types", ContributionTypeLive.Index, :index - live "/contributions/member/:id", ContributionPeriodLive.Show, :show - # Role Management (Admin only) live "/admin/roles", RoleLive.Index, :index live "/admin/roles/new", RoleLive.Form, :new diff --git a/test/mv_web/live/profile_navigation_test.exs b/test/mv_web/live/profile_navigation_test.exs index 849d229..cac6802 100644 --- a/test/mv_web/live/profile_navigation_test.exs +++ b/test/mv_web/live/profile_navigation_test.exs @@ -146,8 +146,6 @@ defmodule MvWeb.ProfileNavigationTest do "/", "/members", "/members/new", - "/custom_field_values", - "/custom_field_values/new", "/users", "/users/new" ]