Allow decimal values in numeric forms#34
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e59ef0984b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return text.replace(/,/g, ""); | ||
| } | ||
|
|
||
| return text.replace(/,/g, "."); |
There was a problem hiding this comment.
Preserve dot-only thousands separators
When a Hungarian amount contains only dot thousands separators, e.g. 1.234.567 Ft from the CSV import or 225.000, this branch leaves the dots in place and normalizeAmount() then turns the value into 0 for multiple groups or 225 for one group instead of the intended amount. The previous normalizer stripped dots, so this regresses common Hungarian-formatted invoice amounts; the same duplicated parser in fleet/utilities has the same failure mode.
Useful? React with 👍 / 👎.
| field("Nettó", '<input name="netAmount" inputmode="decimal" value="' + hAttr(invoice.netAmount || "") + '" />'), | ||
| field("ÁFA", '<input name="vatAmount" inputmode="decimal" placeholder="Automatikus 27%" value="' + hAttr(invoice.vatAmount || "") + '" />'), | ||
| field("Bruttó", '<input name="grossAmount" inputmode="decimal" placeholder="Automatikus" value="' + hAttr(invoice.grossAmount || "") + '" />'), |
There was a problem hiding this comment.
Restore non-negative validation
These amount fields used to be type="number" min="0", but after switching to plain text inputs there is no browser constraint and normalizeAmount() accepts strings like -1000, so a typo can now save negative net/VAT/gross invoices and skew totals. If text inputs are needed for comma decimals, add equivalent validation or clamp/reject negatives before saving.
Useful? React with 👍 / 👎.
Summary
Tests
Closes #33