67 lines
1.8 KiB
Elixir
67 lines
1.8 KiB
Elixir
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"""
|
|
<Layouts.app flash={@flash} current_user={@current_user}>
|
|
<.header>
|
|
Data field value {@custom_field_value.id}
|
|
<:subtitle>This is a custom_field_value record from your database.</:subtitle>
|
|
|
|
<:actions>
|
|
<.button navigate={~p"/custom_field_values"}>
|
|
<.icon name="hero-arrow-left" />
|
|
</.button>
|
|
<.button
|
|
variant="primary"
|
|
navigate={~p"/custom_field_values/#{@custom_field_value}/edit?return_to=show"}
|
|
>
|
|
<.icon name="hero-pencil-square" /> Edit Custom field value
|
|
</.button>
|
|
</:actions>
|
|
</.header>
|
|
|
|
<.list>
|
|
<:item title="Id">{@custom_field_value.id}</:item>
|
|
</.list>
|
|
</Layouts.app>
|
|
"""
|
|
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
|