PhoenixKitCRM.ColumnConfig (PhoenixKitCRM v0.2.0)

Copy Markdown View Source

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 with account_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

all_column_ids(scope)

@spec all_column_ids(PhoenixKitCRM.UserRoleView.scope()) :: [String.t()]

All available column ids for validation.

available_columns(arg1)

@spec available_columns(PhoenixKitCRM.UserRoleView.scope()) :: %{
  standard: map(),
  custom: map()
}

Available columns for a scope, split into :standard and :custom.

default_columns(arg1)

@spec default_columns(PhoenixKitCRM.UserRoleView.scope()) :: [String.t()]

Default selected column ids for a scope.

get_column_metadata(scope, column_id)

@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.

get_columns(user_uuid, scope)

@spec get_columns(binary(), PhoenixKitCRM.UserRoleView.scope()) :: [String.t()]

Returns the selected column ids for a user+scope, falling back to defaults.

update_columns(user_uuid, scope, columns)

@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.

validate_columns(scope, columns)

@spec validate_columns(PhoenixKitCRM.UserRoleView.scope(), [String.t()]) :: [
  String.t()
]

Filter input list to only valid column ids for the scope, preserving order.