Per-scope column configuration for CRM tables and card views.
Mirrors PhoenixKit.Users.TableColumns but is keyed by (user_uuid, scope)
so each admin can have their own column layout per role page and for the
Organizations page. Persistence goes through PhoenixKitCRM.UserRoleView.
Scopes
{:role, role_uuid}— users-of-role page; columns mirror the standard PhoenixKit user fields.:organizations— Organizations page; users withaccount_type = "organization".
Summary
Functions
All available column ids for validation.
Available columns for a scope, split into :standard and :custom.
Default selected column ids for a scope.
Returns metadata for a single column id, or nil. The :label field is translated via gettext.
Returns the selected column ids for a user+scope, falling back to defaults.
Persists the selected column ids for a user+scope. Empty list resets to defaults.
Filter input list to only valid column ids for the scope, preserving order.
Functions
@spec all_column_ids(PhoenixKitCRM.UserRoleView.scope()) :: [String.t()]
All available column ids for validation.
@spec available_columns(PhoenixKitCRM.UserRoleView.scope()) :: %{ standard: map(), custom: map() }
Available columns for a scope, split into :standard and :custom.
@spec default_columns(PhoenixKitCRM.UserRoleView.scope()) :: [String.t()]
Default selected column ids for a scope.
@spec get_column_metadata(PhoenixKitCRM.UserRoleView.scope(), String.t()) :: map() | nil
Returns metadata for a single column id, or nil. The :label field is translated via gettext.
@spec get_columns(binary(), PhoenixKitCRM.UserRoleView.scope()) :: [String.t()]
Returns the selected column ids for a user+scope, falling back to defaults.
@spec update_columns(binary(), PhoenixKitCRM.UserRoleView.scope(), [String.t()]) :: {:ok, PhoenixKitCRM.UserRoleViewConfig.t()} | {:error, Ecto.Changeset.t()}
Persists the selected column ids for a user+scope. Empty list resets to defaults.
@spec validate_columns(PhoenixKitCRM.UserRoleView.scope(), [String.t()]) :: [ String.t() ]
Filter input list to only valid column ids for the scope, preserving order.