iOS: Menge je Lagerort - Lagerort scannen + Einlagern ohne MHD

- Lagerort per QR scannen in Menge-hinzufuegen/entfernen/umlagern (Ziel), nicht
  nur ueber das Dropdown suchen.
- Beim Einlagern laufen "Menge je Lagerort"-Gegenstaende jetzt ueber die Mengen-
  Eingabe (ObjectAddSheet) statt durch den Charge-Weg mit MHD - Socken & Co.
  fragen kein MHD mehr ab.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-29 11:22:40 +02:00
parent 7c359a8f5d
commit 120dfea66a
2 changed files with 31 additions and 1 deletions

View File

@@ -137,11 +137,17 @@ struct CheckInView: View {
ItemAddSheet(productId: item.id, onDone: { ItemAddSheet(productId: item.id, onDone: {
status = "\(item.name): Einzelstück(e) angelegt." status = "\(item.name): Einzelstück(e) angelegt."
}) })
} else { } else if item.foodLike {
// Lebensmittel + Verbrauchsgegenstand: Charge mit Menge/MHD.
CheckInFormView(product: item, units: units, locations: locations) { message in CheckInFormView(product: item, units: units, locations: locations) { message in
status = message status = message
product = nil product = nil
} }
} else {
// Menge je Lagerort (Gegenstand): ohne MHD, direkt Menge + Lagerort.
ObjectAddSheet(product: item, locations: locations,
einheit: item.unitName.isEmpty ? "Stück" : item.unitName,
perform: { status = "\(item.name): Menge eingelagert." })
} }
} }
} }

View File

@@ -193,11 +193,15 @@ struct ObjectAddSheet: View {
@State private var quantity = "" @State private var quantity = ""
@State private var busy = false @State private var busy = false
@State private var error: String? @State private var error: String?
@State private var locScanShown = false
var body: some View { var body: some View {
Form { Form {
Section { Section {
LocationPicker(title: "Lagerort", locations: locations, selection: $locationId) LocationPicker(title: "Lagerort", locations: locations, selection: $locationId)
Button { locScanShown = true } label: {
Label("Lagerort scannen", systemImage: "qrcode.viewfinder")
}
QuantityField(label: "Menge", text: $quantity, suffix: einheit) QuantityField(label: "Menge", text: $quantity, suffix: einheit)
} }
if let error { Section { Text(error).foregroundStyle(.red).font(.callout) } } if let error { Section { Text(error).foregroundStyle(.red).font(.callout) } }
@@ -209,6 +213,10 @@ struct ObjectAddSheet: View {
.navigationTitle("Menge hinzufügen") .navigationTitle("Menge hinzufügen")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { ToolbarItem(placement: .topBarLeading) { Button("Abbrechen") { dismiss() } } } .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Abbrechen") { dismiss() } } }
.fullScreenCover(isPresented: $locScanShown) {
LocationScannerView(locations: locations) { loc in locationId = loc.id }
.ignoresSafeArea()
}
} }
private func save() async { private func save() async {
@@ -239,12 +247,16 @@ struct ObjectRelocateSheet: View {
@State private var quantity = "" @State private var quantity = ""
@State private var busy = false @State private var busy = false
@State private var error: String? @State private var error: String?
@State private var locScanShown = false
var body: some View { var body: some View {
Form { Form {
Section { Section {
LocationPicker(title: "Von", locations: locations, selection: $fromId) LocationPicker(title: "Von", locations: locations, selection: $fromId)
LocationPicker(title: "Nach", locations: locations, selection: $toId) LocationPicker(title: "Nach", locations: locations, selection: $toId)
Button { locScanShown = true } label: {
Label("Ziel-Lagerort scannen", systemImage: "qrcode.viewfinder")
}
QuantityField(label: "Menge", text: $quantity, suffix: product.unitName) QuantityField(label: "Menge", text: $quantity, suffix: product.unitName)
} }
if let error { Section { Text(error).foregroundStyle(.red).font(.callout) } } if let error { Section { Text(error).foregroundStyle(.red).font(.callout) } }
@@ -255,6 +267,10 @@ struct ObjectRelocateSheet: View {
.navigationTitle("Umlagern") .navigationTitle("Umlagern")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { ToolbarItem(placement: .topBarLeading) { Button("Abbrechen") { dismiss() } } } .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Abbrechen") { dismiss() } } }
.fullScreenCover(isPresented: $locScanShown) {
LocationScannerView(locations: locations) { loc in toId = loc.id }
.ignoresSafeArea()
}
.onAppear { fromId = initialFrom } .onAppear { fromId = initialFrom }
} }
@@ -288,11 +304,15 @@ struct ObjectRemoveSheet: View {
@State private var note = "" @State private var note = ""
@State private var busy = false @State private var busy = false
@State private var error: String? @State private var error: String?
@State private var locScanShown = false
var body: some View { var body: some View {
Form { Form {
Section { Section {
LocationPicker(title: "Lagerort", locations: locations, selection: $locationId) LocationPicker(title: "Lagerort", locations: locations, selection: $locationId)
Button { locScanShown = true } label: {
Label("Lagerort scannen", systemImage: "qrcode.viewfinder")
}
QuantityField(label: "Menge", text: $quantity, suffix: einheit) QuantityField(label: "Menge", text: $quantity, suffix: einheit)
Picker("Grund", selection: $reason) { Picker("Grund", selection: $reason) {
ForEach(RemovalReasons.all, id: \.value) { Text($0.label).tag($0.value) } ForEach(RemovalReasons.all, id: \.value) { Text($0.label).tag($0.value) }
@@ -309,6 +329,10 @@ struct ObjectRemoveSheet: View {
.navigationTitle("Aus Bestand entfernen") .navigationTitle("Aus Bestand entfernen")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { ToolbarItem(placement: .topBarLeading) { Button("Abbrechen") { dismiss() } } } .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Abbrechen") { dismiss() } } }
.fullScreenCover(isPresented: $locScanShown) {
LocationScannerView(locations: locations) { loc in locationId = loc.id }
.ignoresSafeArea()
}
.onAppear { locationId = initialLoc } .onAppear { locationId = initialLoc }
} }