PhoenixKitManufacturing.ColumnConfig.Machines (PhoenixKitManufacturing v0.3.2)

Copy Markdown View Source

Column registry for the Machines index list LiveView (PhoenixKitManufacturing.Web.MachinesLive, :index).

Operates on enriched machine maps of shape %{uuid, name, code, status, status_label, location, types_csv, type_names, manufacturer, model, manufacture_year, commissioned_on, warranty_until, to_next_on, data}, built by enrich_machines/2 in the LiveView the same way PhoenixKitWarehouse.ColumnConfig.Inventories's flat maps are built by enrich_documents/1 in inventories_live.ex.

types_csv is the sorted, comma-joined list of machine type names (e.g. "CNC, Milling") used as the :enum filter key — distinct_options/2 returns distinct CSV strings and enum_filter/1 matches on the full CSV. type_names (a sorted list of the same strings) is kept on the enriched map for badge rendering in the LiveView without re-splitting the CSV.

Summary

Functions

Ordered list of column metadata maps. Used by the picker modal.

Map %{id => meta} for fast lookup during a single render pass.

Filter input list to known column ids, preserving order.

Filter input list to known filterable column ids, preserving order.

Functions

all_column_ids()

@spec all_column_ids() :: [String.t()]

available_columns()

@spec available_columns() :: [map()]

Ordered list of column metadata maps. Used by the picker modal.

column_metadata_map()

@spec column_metadata_map() :: %{required(String.t()) => map()}

Map %{id => meta} for fast lookup during a single render pass.

default_columns()

@spec default_columns() :: [String.t()]

scope()

@spec scope() :: String.t()

validate_columns(ids)

@spec validate_columns([String.t()]) :: [String.t()]

Filter input list to known column ids, preserving order.

validate_filters(ids)

@spec validate_filters([String.t()]) :: [String.t()]

Filter input list to known filterable column ids, preserving order.