ohctechv3/.svn/pristine/15/15f04f2d7b4dccc261cb47df396d84d283be9979.svn-base

80 lines
2.6 KiB
Plaintext
Raw Normal View History

2024-10-28 15:03:36 +05:30
import { FormControl, Grid } from "@mui/material";
import PropTypes from "prop-types";
import Input from "../common/Input";
const HealthRiskForm = ({
values,
touched,
handleBlur,
errors,
handleChange,
// setFieldValue,
handleSubmit,
}) => {
HealthRiskForm.propTypes = {
values: PropTypes.object.isRequired,
touched: PropTypes.object.isRequired,
errors: PropTypes.object.isRequired,
handleBlur: PropTypes.func.isRequired,
handleChange: PropTypes.func.isRequired,
setFieldValue: PropTypes.func.isRequired,
handleSubmit: PropTypes.func.isRequired,
};
return (
<div style={{ display: "flex", justifyContent: "center" }}>
<form onSubmit={handleSubmit}>
<Grid container spacing={2} justifyContent="center" alignItems="center" sx={{ width: 320 }} >
<Grid item xs={12} justifyContent="center" alignItems="center">
<FormControl fullWidth>
<Grid container spacing={2} justifyContent="center" alignItems="center">
<Grid item xs={12} container spacing={1} justifyContent="center" alignItems="center">
<Input
label="Health Risk Name"
name="healthRiskName"
type="text"
size="large"
value={values.healthRiskName}
onChange={handleChange}
onBlur={handleBlur}
helperText={
errors.healthRiskName && touched.healthRiskName ? (
<span style={{ color: "red" }}>{errors.healthRiskName}</span>
) : null
}
/>
</Grid>
<Grid item xs={12} container spacing={1} justifyContent="center" alignItems="center">
<Input
label="Health Advice Category"
name="healthRiskCat"
type="text"
size="large"
value={values.healthRiskCat}
onChange={handleChange}
onBlur={handleBlur}
helperText={
errors.healthRiskCat && touched.healthRiskCat ? (
<span style={{ color: "red" }}>
{errors.healthRiskCat}
</span>
) : null
}
/>
</Grid>
</Grid>
</FormControl>
</Grid>
</Grid>
</form>
</div>
);
};
export default HealthRiskForm;