From 4d689228769169955e0c95789691df111a3b2246 Mon Sep 17 00:00:00 2001 From: Schuwi Date: Sun, 14 Sep 2025 20:10:13 +0200 Subject: [PATCH] fix(elixir): storage rendering in component list --- .../live/components_live.ex | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/components_elixir_web/live/components_live.ex b/lib/components_elixir_web/live/components_live.ex index 00b2647..7f9d6b7 100644 --- a/lib/components_elixir_web/live/components_live.ex +++ b/lib/components_elixir_web/live/components_live.ex @@ -295,10 +295,24 @@ defmodule ComponentsElixirWeb.ComponentsLive do end) end + defp storage_location_display_name(location) do + # Use the computed path from Inventory context for full hierarchy, or fall back to location.path + path = Inventory.compute_storage_location_path(location) || location.path + + if path do + # Convert path from "Shelf A/Drawer 2/Box 1" to "Shelf A > Drawer 2 > Box 1" + path + |> String.split("/") + |> Enum.join(" > ") + else + location.name + end + end + defp storage_location_options(storage_locations) do [{"No storage location", nil}] ++ Enum.map(storage_locations, fn location -> - {location.path, location.id} + {storage_location_display_name(location), location.id} end) end @@ -703,7 +717,7 @@ defmodule ComponentsElixirWeb.ComponentsLive do
<%= if component.storage_location do %>

- Location: {Inventory.compute_storage_location_path(component.storage_location)} + Location: {storage_location_display_name(component.storage_location)}

<% end %>