PhoenixKitWarehouse.Web.Components.RelatedDocuments (PhoenixKitWarehouse v0.2.1)

Copy Markdown View Source

Shared "related documents" card fragment for warehouse document forms.

Consolidates the upstream/downstream link blocks that were duplicated inline in InternalOrderFormLive and SupplierOrderFormLive (§7 list-MVP of the warehouse traceability model):

  • upstream — documents this one was imported from or manually linked to via PhoenixKitWarehouse.SourceKinds. Always rendered, even when empty, because the block also carries the "Attach" control (phx-click="open_link_picker") that lets the keeper add the first link; each attached ref gets a "remove" button (phx-click="remove_source_ref", phx-value-type, phx-value-uuid).
  • downstream — documents created from this one (e.g. a Goods Receipt spawned from a Supplier Order). Read-only — no attach/remove controls — and the whole block is skipped when the list is empty.

Both attrs take the ref-map shape produced by PhoenixKitWarehouse.DocRefs: %{label:, path:, uuid:, kind:}. The calling LiveView owns the open_link_picker / remove_source_ref event handlers and the source_refs / child-refs assigns that feed this component — this module only renders.

Summary

Functions