prevent proposed amount to get negetive values

This commit is contained in:
2023-07-17 14:27:47 +03:30
parent 74245025d6
commit fa8e0ba1e7

View File

@@ -41,7 +41,9 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => {
setDescription(event.target.value);
};
const handleAmountChange = (event) => {
setProposedAmount(event.target.value);
if (/^\d*$/.test(event.target.value)) {
setProposedAmount(event.target.value);
}
formik.handleChange(event);
};
@@ -65,6 +67,11 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => {
name="proposed_amount"
label={t("MachinaryOffice.proposed_amount")}
type="number"
inputProps={{
min: 0,
inputMode: "numeric",
pattern: "[0-9]*",
}}
variant="outlined"
value={proposedAmount}
onChange={handleAmountChange}