iOS: Lagerort-Picker zeigen den vollen Pfad statt nur den Namen

Wie im Web: alle Lagerort-Auswahlen (Einlagern, Einzelstueck/Item, Objekt-Bestand hinzufuegen/umlagern/entfernen, Mindestbestand je Ort) zeigen 'Hedingen -> Keller -> Schublade 1' statt nur 'Schublade 1', damit gleichnamige Orte unterscheidbar sind. Neuer Helfer StorageLocation.path(in:) bzw. locationPath(_:in:) in Models.swift.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-27 13:27:02 +02:00
parent c8c1686395
commit 1db2d6389c
5 changed files with 30 additions and 6 deletions

View File

@@ -29,7 +29,8 @@ struct ObjectStockSection: View {
private var einheit: String { product.unitName.isEmpty ? "Stück" : product.unitName }
private func ortName(_ id: String?) -> String {
guard let id else { return "Ohne Lagerort" }
return locations.first { $0.id == id }?.name ?? "Ort \(id)"
let pfad = locationPath(id, in: locations)
return pfad.isEmpty ? "Ort \(id)" : pfad
}
var body: some View {
@@ -175,7 +176,7 @@ private struct LocationPicker: View {
var body: some View {
Picker(title, selection: $selection) {
Text(" ohne Lagerort ").tag(String?.none)
ForEach(locations) { loc in Text(loc.name).tag(String?.some(loc.id)) }
ForEach(locations) { loc in Text(loc.path(in: locations)).tag(String?.some(loc.id)) }
}
}
}