fix: prevent negative numeric inputs in rental forms by enforcing positive constraints and sanitizing user entries

This commit is contained in:
sazzadulalambd
2026-04-26 14:59:27 +06:00
parent 7457b997ef
commit f724a00453
2 changed files with 16 additions and 7 deletions

View File

@@ -609,8 +609,9 @@ export default function RentalDetailPage() {
<label className="text-sm text-slate-600">Due Amount ()</label>
<input
type="number"
min={0}
value={dueAmount}
onChange={(e) => setDueAmount(Number(e.target.value))}
onChange={(e) => setDueAmount(Math.max(0, Number(e.target.value)))}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
placeholder="Enter amount..."
/>