diff --git a/ios/Sources/ItemViews.swift b/ios/Sources/ItemViews.swift index 27032c8..2229b80 100644 --- a/ios/Sources/ItemViews.swift +++ b/ios/Sources/ItemViews.swift @@ -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 ?? ""