iOS: Mindestbestand je Lagerort (Produkte) + Einkaufsliste je Ort
- Produkt-Detail: neuer Editor „Mindestbestand je Lagerort" (Zeilen: Lagerort + Menge in Artikeleinheiten), zusaetzlich zum Gesamt-Mindestbestand. - Einkaufsliste: Abschnitte „Bedarf: <Lagerort>" mit Produkten und Gruppen, die am Ort unter dem dort hinterlegten Mindestbestand liegen. - Models/Client: LocationMinStock(+In), LocationNeeds*, setProductLocationMinStock, shoppingByLocation; Product um location_min_stocks erweitert. (Gruppen-Bedarf je Ort ist vorerst nur im Web pflegbar, wird aber in der iOS- Einkaufsliste mit angezeigt.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,7 @@ struct ShoppingListView: View {
|
||||
|
||||
@State private var items: [ShoppingItem] = []
|
||||
@State private var groups: [GroupShoppingItem] = []
|
||||
@State private var byLocation: [LocationNeeds] = []
|
||||
@State private var busy = true
|
||||
@State private var error: String?
|
||||
|
||||
@@ -80,7 +81,25 @@ struct ShoppingListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
if items.isEmpty && groups.isEmpty && !busy {
|
||||
ForEach(byLocation) { ort in
|
||||
Section("Bedarf: \(ort.locationName)") {
|
||||
ForEach(ort.products) { p in
|
||||
ListRow(
|
||||
systemImage: "shippingbox",
|
||||
title: p.name,
|
||||
subtitle: "fehlt \(formatAmount(p.deficit)) \(p.unitLabel)"
|
||||
) { EmptyView() }
|
||||
}
|
||||
ForEach(ort.groups) { g in
|
||||
ListRow(
|
||||
systemImage: "square.stack.3d.up",
|
||||
title: g.name,
|
||||
subtitle: "fehlt \(formatAmount(g.deficit)) \(g.unitName)"
|
||||
) { GroupBadge() }
|
||||
}
|
||||
}
|
||||
}
|
||||
if items.isEmpty && groups.isEmpty && byLocation.isEmpty && !busy {
|
||||
Text("Nichts einzukaufen – alle Mindestbestände sind gedeckt.")
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
@@ -97,6 +116,7 @@ struct ShoppingListView: View {
|
||||
do {
|
||||
items = try await APIClient.shared.shoppingList()
|
||||
groups = try await APIClient.shared.shoppingGroups()
|
||||
byLocation = try await APIClient.shared.shoppingByLocation()
|
||||
error = nil
|
||||
} catch {
|
||||
self.error = error.localizedDescription
|
||||
|
||||
Reference in New Issue
Block a user