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 locations: [StorageLocation] = []
|
||||||
@State private var shops: [ShopItem] = []
|
@State private var shops: [ShopItem] = []
|
||||||
|
@State private var photo: Data?
|
||||||
@State private var locationId: Int?
|
@State private var locationId: Int?
|
||||||
@State private var shopId: Int?
|
@State private var shopId: Int?
|
||||||
@State private var hasAcquired = false
|
@State private var hasAcquired = false
|
||||||
@@ -104,15 +105,19 @@ struct ItemEditView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
Section {
|
Section {
|
||||||
if let img = QRImage.make(qrLink(forUid: item.uid)) {
|
if let photo, let ui = UIImage(data: photo) {
|
||||||
Image(uiImage: img)
|
Image(uiImage: ui)
|
||||||
.interpolation(.none).resizable().scaledToFit()
|
.resizable().scaledToFit()
|
||||||
.frame(maxWidth: .infinity).frame(height: 180)
|
.frame(maxWidth: .infinity).frame(maxHeight: 220)
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||||
}
|
}
|
||||||
LabeledContent("UID", value: item.uid)
|
|
||||||
if let name = item.productName {
|
if let name = item.productName {
|
||||||
LabeledContent("Artikel", value: name)
|
LabeledContent("Artikel", value: name)
|
||||||
}
|
}
|
||||||
|
if let brand = item.productBrand, !brand.isEmpty {
|
||||||
|
LabeledContent("Marke", value: brand)
|
||||||
|
}
|
||||||
|
LabeledContent("UID", value: item.uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
@@ -165,6 +170,7 @@ struct ItemEditView: View {
|
|||||||
private func load() async {
|
private func load() async {
|
||||||
locations = (try? await APIClient.shared.locations()) ?? []
|
locations = (try? await APIClient.shared.locations()) ?? []
|
||||||
shops = (try? await APIClient.shared.shops()) ?? []
|
shops = (try? await APIClient.shared.shops()) ?? []
|
||||||
|
photo = try? await APIClient.shared.productImage(id: item.productId)
|
||||||
locationId = item.locationId
|
locationId = item.locationId
|
||||||
shopId = item.shopId
|
shopId = item.shopId
|
||||||
note = item.note ?? ""
|
note = item.note ?? ""
|
||||||
|
|||||||
Reference in New Issue
Block a user