124 lines
4.2 KiB
Plaintext
124 lines
4.2 KiB
Plaintext
import Input from "../common/Input";
|
|
import PropTypes from "prop-types";
|
|
import { Grid} from "@mui/material";
|
|
import SingleSelect from "../common/SingleSelect";
|
|
|
|
const FoodMasterForm = ({values,
|
|
touched,
|
|
handleBlur,
|
|
errors,
|
|
handleChange,
|
|
setFieldValue,
|
|
handleSubmit,
|
|
foodname,
|
|
}) => {
|
|
|
|
/// this form is not being used yet
|
|
FoodMasterForm.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,
|
|
};
|
|
|
|
// const DeepFry = ["Yes","No"];
|
|
|
|
return (
|
|
<form onSubmit={handleSubmit}>
|
|
<Grid container spacing={2} justifyContent="center" alignItems="center">
|
|
<Grid item xs={12} sm={12} spacing={1} container justifyContent="center" alignItems="center">
|
|
{/*<Input
|
|
label="Food Name"
|
|
name="foodId"
|
|
type="text"
|
|
size="large"
|
|
sx={{ width: "300px" }}
|
|
value={values.foodId}
|
|
onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
helperText={
|
|
errors.foodId && touched.foodId ? (
|
|
<span style={{ color: "red" }}>
|
|
{errors.foodId}
|
|
</span>
|
|
) : null
|
|
}
|
|
/>*/}
|
|
<SingleSelect
|
|
arr={foodname}
|
|
label="Food Name"
|
|
name="foodname"
|
|
value={values.foodname}
|
|
sx={{ width: '250px' }}
|
|
// onChange={(event, newValue) => {
|
|
// const syntheticEvent = {
|
|
// target: {
|
|
// name: "foodname",
|
|
// value: newValue,
|
|
// },
|
|
// };
|
|
// handleChange(syntheticEvent);
|
|
// }}
|
|
// handleChange ={handleChange}
|
|
|
|
onChange={(event, newValue) => {
|
|
setFieldValue('foodname', newValue ? newValue.label : '');
|
|
}}
|
|
|
|
onBlur={handleBlur}
|
|
type="text"
|
|
helperText={
|
|
errors.foodname && touched.foodname ? (
|
|
<span style={{ color: "red" }}>{errors.foodname}</span>
|
|
) : null
|
|
}
|
|
/>
|
|
</Grid>
|
|
|
|
<Grid item xs={12} sm={12} container spacing={1} justifyContent="center" alignItems="center">
|
|
<Input
|
|
label="Quantity in grams"
|
|
name="quantityInGrams"
|
|
type="text"
|
|
size="large"
|
|
value={values.quantityInGrams}
|
|
onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
helperText={
|
|
errors.quantityInGrams && touched.quantityInGrams ? (
|
|
<span style={{ color: "red" }}>
|
|
{errors.quantityInGrams}
|
|
</span>
|
|
) : null
|
|
}
|
|
/>
|
|
</Grid>
|
|
<Grid item xs={12} sm={12} container spacing={1} justifyContent="center" alignItems="center">
|
|
<Input
|
|
label=""
|
|
name="date"
|
|
type="date"
|
|
size="large"
|
|
value={values.date}
|
|
onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
helperText={
|
|
errors.date && touched.date ? (
|
|
<span style={{ color: "red" }}>
|
|
{errors.date}
|
|
</span>
|
|
) : null
|
|
}
|
|
/>
|
|
</Grid>
|
|
</Grid>
|
|
</form>
|
|
)
|
|
}
|
|
|
|
export default FoodMasterForm;
|
|
|