PhoenixKitWarehouse.ColumnConfig (PhoenixKitWarehouse v0.1.0)

Copy Markdown View Source

Shared column-registry engine for warehouse list LiveViews.

Consolidates what were 6 near-byte-identical *_column_config.ex files in Andi (internal_order_column_config.ex, inventory_column_config.ex, stock_column_config.ex, supplier_order_column_config.ex, goods_issue_column_config.ex, goods_receipt_column_config.ex) into one engine (use PhoenixKitWarehouse.ColumnConfig, scope: "...") plus 6 short columns/0 definitions — see PhoenixKitWarehouse.ColumnConfig.{InternalOrders, Inventories, Stock, SupplierOrders, GoodsIssues, GoodsReceipts}.

Each column is a map with structural metadata:

  • :id — string identifier persisted in the per-user view config.
  • :label — zero-arity fn returning the translated header label.
  • :default? — included in default_columns/0.
  • :align:left (default) or :right.
  • :sortable? / :sort_key — sortability + key extractor (entry -> term).
  • :default_dir — direction the column toggles to on first sort.
  • :filterable? / :filter_type:text | :enum | :date_range | :numeric_range.

  • :filter_apply(entries, value) -> entries.
  • :filter_options — for :enum only, (entries -> [{value, label}]).

Cell/header rendering stays in the LiveView — only structural metadata lives here so it can be reused for table, sort headers, and filter chips.

Summary

Functions

date_of(dt)

date_range_filter(get_fn)

datetime_to_unix(dt)

decimal_to_float(d)

distinct_options(entries, key)

enum_filter(get_fn)

numeric_range_filter(get_fn)

text_filter(get_fn)

to_number(d)