Skip to content

Catalogue 0.3.0: Catalogue folders, status tabs and duplicate SKUs

Catalogue 0.3.0 lets admins file catalogues into nested folders, shows each catalogue’s items in tabs by status, turns the catalogue page into a category drill-down, and accepts the same SKU on more than one item.

Folders

The catalogue list at /admin/catalogue is now a folder tree, like a file manager. Folders can be nested and opened with arrows. Catalogues are filed by dragging them onto a folder or with Move to folder in their actions. New folders appear at the top. Folders belong to the catalogue module and have nothing to do with media folders. Changes show up in other open admin sessions without a reload.

Status tabs and drill-down

A catalogue’s page now shows its items in Active, Inactive, Discontinued and Deleted tabs. Discontinued items are no longer mixed into Active, and an empty Inactive tab is hidden. The page now moves through categories one level at a time, with sorting, bulk selection and loading more items as you go. The open category is kept in the address as ?category=, so it can be linked and the back button works. Moving items between categories by dragging is replaced by a Move action on the selected items.

The catalogue admin pages use the full width with a header driven by the sidebar, instead of three tabs at the top.

Duplicate SKUs

Two items can now share a SKU, because core migration V123 removes the unique SKU index.

Fixes

  • A deleted item could still be put back into the active order from another tab.
  • Two folder moves at once could create a loop that hid folders from the tree.

Upgrading

Catalogue 0.3 needs PhoenixKit 1.7.125 or later. Run mix phoenix_kit.update so core migration V123 adds the folders table and drops the unique SKU index.

Full release notes: Catalogue 0.3.0

0.3.0 · 29 May 2026

Added

  • Catalogue folders — an inline, nested folder tree-table on /admin/catalogue (Finder-style): disclosure chevrons, native drag-and-drop filing, an Actions “Move to folder” picker, and front-insertion so new folders surface at the top. Folders are module-global (a dedicated phoenix_kit_cat_folders table; requires core V123) and unrelated to the media-folder system. New schema PhoenixKitCatalogue.Schemas.Folder and cat_catalogues.folder_uuid (ON DELETE SET NULL). New context API: list_folder_tree/1, catalogues_by_folder/1, folder_uuids_with_children/1, get_folder/1, create_folder/2, update_folder/3, move_folder/3, trash_folder/2, restore_folder/2, permanently_delete_folder/2, reorder_folders/2, move_catalogue_to_folder/3. Folder mutations broadcast a :folder PubSub event so the tree converges across open sessions.
  • Per-status item tabs on the catalogue detail page — Active / Inactive / Discontinued / Deleted (empty Inactive hidden); discontinued items are no longer mixed into Active.
  • Detail drill-down rework — the detail page is now a category drill-down built on the core list-UI toolkit (sortable / bulk-select / load_more), replacing the old per-card expand mechanism. The current category is carried in ?category= for deep-linkable, back-button-friendly navigation.

Changed

  • Full-width, sidebar-driven layout for the catalogue admin pages — the three redundant top tabs are replaced by a sidebar-driven header.
  • Duplicate SKUs are now accepted — core V123 drops the global unique cat_items.sku index.
  • Housekeeping: catalogue search-empty states use core <.empty_state>; blank-string normalization migrated to PhoenixKit.Utils.Values.blank_to_nil.

Fixed

  • Reorder no longer re-slots a trashed item into the active sequence — item_scope_check/3 now excludes status = "deleted" (parity with the active-only :all reorder path), closing a cross-tab race where an item selected client-side then trashed elsewhere could still be repositioned.
  • Folder moves are now serialized — the cycle check + validation + update run inside a transaction with FOR UPDATE on the moved row (parity with category moves), so concurrent reparents can’t commit a cycle that would vanish from the tree view.
  • Test suite repaired — the suite had been silently uncompilable since the PDF sweep (a with_scope/2 helper that never existed); added the missing LiveView scope test-infra + PDF routes and folder / PubSub / status-count coverage.
  • De-brittled the smart-pricing float-qty test (assert behavior, not version-dependent Decimal internals).
  • Trimmed redundant work on the index render (duplicate folder-tree / count queries) and the detail load_level (fetched both :active and :deleted child-category lists and discarded one; ran a per-category count GROUP BY even on the status tabs where no cards render).

Removed

  • Cross-category drag-move on the detail page — superseded by the explicit bulk “Move” modal in the single-node drill view.
  • Dead code: list_child_folders/2 and folder_catalogue_counts/0.

Notes

  • Requires core V123 (catalogue folders + dropping the global unique cat_items.sku index), first shipped in phoenix_kit 1.7.125. The dep constraint is now ~> 1.7 and >= 1.7.125 — floored at the V123 release while keeping the < 2.0.0 upper bound loose. Run migrations against a phoenix_kit ≥ 1.7.125 host.

Catalogue 0.3.0. Install or update: {:phoenix_kit_catalogue, "~> 0.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.