diff --git a/backlog/features.json b/backlog/features.json index 5283478..99eecbc 100644 --- a/backlog/features.json +++ b/backlog/features.json @@ -7064,13 +7064,15 @@ "description": "POS discount input must accept 3,50 or 3.50 as EUR instead of raw cents", "priority": "high", "risk": "med", - "status": "pending", + "status": "done", "created_at": "2026-08-22", "gates": { - "reviewer": false, - "security": false, - "qa": false - } + "reviewer": true, + "security": true, + "qa": true, + "close": true + }, + "completed_at": "2026-08-22T17:07:28Z" }, { "id": "F-181", diff --git a/project/apps/pos/src/components/DiscountPanel.tsx b/project/apps/pos/src/components/DiscountPanel.tsx index c79439d..9c99aef 100644 --- a/project/apps/pos/src/components/DiscountPanel.tsx +++ b/project/apps/pos/src/components/DiscountPanel.tsx @@ -15,13 +15,15 @@ export default function DiscountPanel({ unitPriceCents, onApply, onClose }: Disc const [value, setValue] = useState(''); const [error, setError] = useState(''); - const discountCents = - mode === 'percent' - ? Math.round(((Number(value) || 0) / 100) * unitPriceCents) - : Number(value) || 0; + const numericValue = Number(value.replace(',', '.')); + const discountCents = Number.isFinite(numericValue) + ? mode === 'percent' + ? Math.round((numericValue / 100) * unitPriceCents) + : Math.round(numericValue * 100) + : 0; const handleApply = () => { - if (!value) return; + if (!value || numericValue <= 0) return; if (discountCents > unitPriceCents) { setError('Descuento mayor al precio'); return; } onApply(discountCents); onClose(); @@ -36,13 +38,13 @@ export default function DiscountPanel({ unitPriceCents, onApply, onClose }: Disc