Commit 06f47170 by tdgiang

Widen payment amount validation to 10,000-20,000,000 VNĐ (inclusive)

Replaces the strict >1,000,000/<20,000,000 range with an inclusive
>=10,000/<=20,000,000 range, matching the actual usable range confirmed
on the real Sổ Bán Lẻ catalog after the earlier per-line-qty fix.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KPzWwuTEeX2vXGXvyGn4q
parent 9df1644b
......@@ -29,8 +29,8 @@ exports.createTransaction = function (req, res) {
if (
!isFinite(targetAmount) ||
String(targetAmount) !== String(rawAmount).trim() ||
targetAmount <= 1000000 ||
targetAmount >= 20000000
targetAmount < 10000 ||
targetAmount > 20000000
) {
return res.status(400).json({ code: "99", data: "INVALID_AMOUNT" });
}
......
......@@ -407,12 +407,12 @@
<div class="field" data-field="amount">
<label for="amount">Số tiền thanh toán</label>
<div class="amount-field">
<input type="number" id="amount" name="amount" placeholder="0" min="1000001" max="19999999" step="1" inputmode="numeric" required aria-describedby="amount-error amount-preview">
<input type="number" id="amount" name="amount" placeholder="0" min="10000" max="20000000" step="1" inputmode="numeric" required aria-describedby="amount-error amount-preview">
<span class="amount-suffix">VNĐ</span>
</div>
<p class="field-error" id="amount-error" role="alert">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
Số tiền phải lớn hơn 1,000,000 và nhỏ hơn 20,000,000 VNĐ
Số tiền phải từ 10,000 đến 20,000,000 VNĐ
</p>
<p class="amount-preview" id="amount-preview" aria-live="polite"></p>
<div class="amount-presets" role="group" aria-label="Chọn nhanh số tiền">
......@@ -484,7 +484,7 @@
if (!data.customerAddress.trim()) { setFieldInvalid('customerAddress'); valid = false; } else { setFieldValid('customerAddress'); }
if (!data.customerIdCard.trim()) { setFieldInvalid('customerIdCard'); valid = false; } else { setFieldValid('customerIdCard'); }
var amountNum = parseInt(data.amount, 10);
if (!isFinite(amountNum) || amountNum <= 1000000 || amountNum >= 20000000) { setFieldInvalid('amount'); valid = false; } else { setFieldValid('amount'); }
if (!isFinite(amountNum) || amountNum < 10000 || amountNum > 20000000) { setFieldInvalid('amount'); valid = false; } else { setFieldValid('amount'); }
return valid;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment