115 lines
3.9 KiB
Plaintext
115 lines
3.9 KiB
Plaintext
import { FormControl, Grid, TextField } from "@mui/material";
|
|
import PropTypes from "prop-types";
|
|
import Input from "../common/Input";
|
|
import SingleSelect from "../common/SingleSelect"
|
|
import MultipleSelect from "../common/MultipleSelect";
|
|
import { InputLabel, MenuItem, Select } from "@mui/material";
|
|
import Autocomplete from "@mui/material/Autocomplete";
|
|
import { useState } from "react";
|
|
import MultiCheckbox from "./MultiCheckbox";
|
|
|
|
const MedicalForm = ({
|
|
values,
|
|
touched,
|
|
handleBlur,
|
|
errors,
|
|
handleChange,
|
|
setFieldValue,
|
|
handleSubmit,
|
|
}) => {
|
|
MedicalForm.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 Default = ["Yes", "No"];
|
|
|
|
|
|
return (
|
|
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
<form onSubmit={handleSubmit}>
|
|
<Grid container spacing={2} justifyContent="center" alignItems="center" sx={{width:300}}>
|
|
|
|
<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="Medical Form Name"
|
|
name="formName"
|
|
type="text"
|
|
size="large"
|
|
value={values.formName}
|
|
onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
helperText={
|
|
errors.formName && touched.formName ? (
|
|
<span style={{ color: "red" }}>{errors.formName}</span>
|
|
) : null
|
|
}
|
|
/>
|
|
</Grid>
|
|
<Grid item xs={12} container spacing={1} justifyContent="center" alignItems="center">
|
|
<Input
|
|
label="Medical Form Code"
|
|
name="formCode"
|
|
type="text"
|
|
size="large"
|
|
value={values.formCode}
|
|
onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
helperText={
|
|
errors.formCode && touched.formCode ? (
|
|
<span style={{ color: "red" }}>
|
|
{errors.formCode}
|
|
</span>
|
|
) : null
|
|
}
|
|
/>
|
|
</Grid>
|
|
|
|
|
|
<Grid item xs={12} container spacing={1} justifyContent="center" alignItems="center">
|
|
<SingleSelect
|
|
arr={Default}
|
|
label="Is QTY fixed"
|
|
name="isQtyFixed"
|
|
value={values.isQtyFixed}
|
|
onChange={(event, newValue) => {
|
|
const syntheticEvent = {
|
|
target: {
|
|
name: "isQtyFixed",
|
|
value: newValue,
|
|
},
|
|
};
|
|
handleChange(syntheticEvent);
|
|
}}
|
|
// onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
type="text"
|
|
helperText={
|
|
errors.isQtyFixed && touched.isQtyFixed ? (
|
|
<span style={{ color: "red" }}>
|
|
{errors.isQtyFixed}
|
|
</span>
|
|
) : null
|
|
}
|
|
/>
|
|
</Grid>
|
|
</Grid>
|
|
</FormControl>
|
|
</Grid>
|
|
</Grid>
|
|
</form>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default MedicalForm;
|
|
|