Preis-Vorschlag: Auswahl aus mehreren erkannten Beträgen

Findet die Beleg-Analyse mehrere Beträge, liefert der Upload jetzt eine
Kandidatenliste (bester Tipp zuerst). Web und iOS bieten dann ein Dropdown zur
Auswahl des richtigen Kaufpreises, statt nur den automatischen Tipp. 1 neuer
Test; Backend-Suite gruen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-27 06:39:03 +02:00
parent 761c131286
commit 2bc871f229
7 changed files with 94 additions and 8 deletions

View File

@@ -88,6 +88,7 @@ export default function Einzelstuecke({ product, locations, shops, isAdmin, onCh
itemId: item.id,
date: res.suggested_warranty_until || null,
priceCents: res.suggested_price_cents ?? null,
priceCandidates: res.suggested_price_candidates || [],
});
}
toast("Beleg hochgeladen.");
@@ -266,14 +267,27 @@ export default function Einzelstuecke({ product, locations, shops, isAdmin, onCh
</label>
{suggestion && suggestion.itemId === it.id
&& (suggestion.date || suggestion.priceCents != null) && (
<div className="alert ok" style={{ marginTop: "var(--sp-2)" }}>
<div className="alert ok" style={{ marginTop: "var(--sp-2)", flexWrap: "wrap" }}>
<Icon name="check" size={16} />
<span>
Im Beleg erkannt:
{suggestion.date ? ` Garantie bis ${suggestion.date}` : ""}
{suggestion.date && suggestion.priceCents != null ? "," : ""}
{suggestion.priceCents != null ? ` Kaufpreis ${(suggestion.priceCents / 100).toFixed(2)}` : ""}.
Im Beleg erkannt
{suggestion.date ? `: Garantie bis ${suggestion.date}` : ""}
</span>
{suggestion.priceCents != null && (
(suggestion.priceCandidates || []).length > 1 ? (
<label className="check-inline" style={{ margin: 0, gap: 4 }}>
Kaufpreis
<select value={suggestion.priceCents} style={{ width: "auto", marginTop: 0 }}
onChange={(e) => setSuggestion({ ...suggestion, priceCents: Number(e.target.value) })}>
{suggestion.priceCandidates.map((c) => (
<option key={c} value={c}>{(c / 100).toFixed(2)} {it.currency || "CHF"}</option>
))}
</select>
</label>
) : (
<span>Kaufpreis {(suggestion.priceCents / 100).toFixed(2)} {it.currency || "CHF"}</span>
)
)}
<button type="button" className="btn sm" style={{ marginLeft: "auto" }}
onClick={() => {
const body = {};