iOS: Einzelstück-Ansicht zeigt Produktbild statt QR-Code
Beim Nachschlagen/Öffnen eines Einzelstuecks stand oben das QR-Bild - unnoetig, den hat man ja gerade gescannt. Jetzt oben das Produktbild plus Name/Marke; die stueckspezifischen Angaben (UID, Kaufdatum, Garantie, Ort, Notiz) bleiben. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,7 @@ struct ItemEditView: View {
|
||||
|
||||
@State private var locations: [StorageLocation] = []
|
||||
@State private var shops: [ShopItem] = []
|
||||
@State private var photo: Data?
|
||||
@State private var locationId: Int?
|
||||
@State private var shopId: Int?
|
||||
@State private var hasAcquired = false
|
||||
@@ -104,15 +105,19 @@ struct ItemEditView: View {
|
||||
var body: some View {
|
||||
Form {
|
||||
Section {
|
||||
if let img = QRImage.make(qrLink(forUid: item.uid)) {
|
||||
Image(uiImage: img)
|
||||
.interpolation(.none).resizable().scaledToFit()
|
||||
.frame(maxWidth: .infinity).frame(height: 180)
|
||||
if let photo, let ui = UIImage(data: photo) {
|
||||
Image(uiImage: ui)
|
||||
.resizable().scaledToFit()
|
||||
.frame(maxWidth: .infinity).frame(maxHeight: 220)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||
}
|
||||
LabeledContent("UID", value: item.uid)
|
||||
if let name = item.productName {
|
||||
LabeledContent("Artikel", value: name)
|
||||
}
|
||||
if let brand = item.productBrand, !brand.isEmpty {
|
||||
LabeledContent("Marke", value: brand)
|
||||
}
|
||||
LabeledContent("UID", value: item.uid)
|
||||
}
|
||||
|
||||
Section {
|
||||
@@ -165,6 +170,7 @@ struct ItemEditView: View {
|
||||
private func load() async {
|
||||
locations = (try? await APIClient.shared.locations()) ?? []
|
||||
shops = (try? await APIClient.shared.shops()) ?? []
|
||||
photo = try? await APIClient.shared.productImage(id: item.productId)
|
||||
locationId = item.locationId
|
||||
shopId = item.shopId
|
||||
note = item.note ?? ""
|
||||
|
||||
Reference in New Issue
Block a user