import {
FormControl,
Grid,
Stack,
TextField,
useMediaQuery,
Select,
} from "@mui/material";
import Box from '@mui/material/Box';
import { useTheme } from "@mui/material/styles";
import PropTypes from "prop-types";
import Input from "../common/Input";
import SingleSelect from "../common/SingleSelect";
import SingleSelectNew from "../common/SingleSelectNew";
import MultipleSelectNew from "../common/MultipleSelectNew";
import { Fullscreen } from "@mui/icons-material";
import TextArea from "../common/TextArea";
//import Input from "./Input";
//import Input from "../Input";
const CheckupParameterForm = ({
values,
touched,
handleBlur,
errors,
handleChange,
setFieldValue,
handleSubmit,
getFieldProps,
keyHealthParameter,
lessMoreRisk,
healthAdvice,
checkupSection,
checkupParaValues,
checkupType,
unitDate,
ruleEquation
}) => {
CheckupParameterForm.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 healthkeyselect = ["Capital/non consumeble instruments", "other"];
const lessriskselect = ["Active", "Not Active"];
const moreriskselect = ["Active", "Not Active"];
const lessadviceselect = ["Active", "Not Active"];
const moreadviceselect = ["Active", "Not Active"];
const sectionselect = ["I", "II", "III"];
const inputtypeselect = ["Text", "Number"];
const statusselect = ["Lower", "Middle"];
const editableselect = ["Yes", "No"];
const unitselect = ["Yes", "No"];
const paramselect = ["opd", "daycare", "injury"];
const rulesselect = ["Yes", "No"];
const parentselect = ["Yes", "No"];
const ailment = [{ label: "Yes", id: 1 }];
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
const isSmaller = useMediaQuery(theme.breakpoints.down("sm"));
return (
{errors.parameterName}
) : null
}
/>
option.label}
value={
keyHealthParameter.find((option) => option.id === values.keyHealthMapNameId) || null
}
onChange={(event, newValue) => {
setFieldValue("keyHealthMapNameId", newValue ? newValue.id : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
{errors.startingRange}
) : null
}
/>
{errors.endingRange}
) : null
}
/>
values.lessRisksIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("lessRisksIds", selectedIds);
}}
onBlur={handleBlur}
options={lessMoreRisk}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
values.moreRisksIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("moreRisksIds", selectedIds);
}}
onBlur={handleBlur}
options={lessMoreRisk}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
values.lessAdvicesIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("lessAdvicesIds", selectedIds);
}}
onBlur={handleBlur}
options={healthAdvice}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
values.moreAdvicesIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("moreAdvicesIds", selectedIds);
}}
onBlur={handleBlur}
options={healthAdvice}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
option.label}
value={
checkupSection.find((option) => option.id === values.checkupFormSectionId) || null
}
onChange={(event, newValue) => {
setFieldValue("checkupFormSectionId", newValue ? newValue.id : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
{errors.columnorder}
) : null
}
/>
{errors.columnName}
) : null
}
/>
{errors.groupId}
) : null
}
/>
{errors.placeHolderName}
) : null
}
/>
values.parameterValueIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("parameterValueIds", selectedIds);
}}
onBlur={handleBlur}
options={checkupParaValues}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
option}
value={values.inputType}
onChange={(event, newValue) => {
setFieldValue("inputType", newValue ? newValue : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
values.checkupTypeIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("checkupTypeIds", selectedIds);
}}
onBlur={handleBlur}
options={checkupType}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
option}
// value={values.enabled}
// value={values.enabled === "Y" ? "Active" : "Inactive"}
// onChange={(event, newValue) => {
// setFieldValue("enabled", newValue === "Active" ? 'Y' : "N"); // Store only the id in Formik
// }}
value={
values.enabled === "Y" ? "Active" :
values.enabled === "N" ? "Inactive" : "" // Display empty on start
}
onChange={(event, newValue) => {
if (newValue === "Active") {
setFieldValue("enabled", "Y");
} else if (newValue === "Inactive") {
setFieldValue("enabled", "N");
} else {
setFieldValue("enabled", ""); // Handle clearing the selection
}
}}
onBlur={handleBlur}
/>
option}
value={
values.readonlyField === "Y" ? "Editable" :
values.readonlyField === "N" ? "Non-Editable" : "" // Display empty on start
}
onChange={(event, newValue) => {
if (newValue === "Editable") {
setFieldValue("readonlyField", "Y");
} else if (newValue === "Non-Editable") {
setFieldValue("readonlyField", "N");
} else {
setFieldValue("readonlyField", ""); // Handle clearing the selection
}
}}
onBlur={handleBlur}
/>
option.label}
value={
unitDate.find((option) => option.id === values.unitId) || null
}
onChange={(event, newValue) => {
setFieldValue("unitId", newValue ? newValue.id : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
option.label}
value={
[{label : 'Yes',id : 1},{label : 'No',id : 0}].find((option) => option.id === values.opdParam) || null
}
onChange={(event, newValue) => {
setFieldValue("opdParam", newValue ? newValue.id : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
option.label}
value={
[{label : 'Yes',id : 1},{label : 'No',id : 0}].find((option) => option.id === values.ipdParam) || null
}
onChange={(event, newValue) => {
setFieldValue("ipdParam", newValue ? newValue.id : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
option.label}
value={
[{label : 'Yes',id : 1},{label : 'No',id : 0}].find((option) => option.id === values.injParam) || null
}
onChange={(event, newValue) => {
setFieldValue("injParam", newValue ? newValue.id : ""); // Store only the id in Formik
}}
onBlur={handleBlur}
/>
values.ruleIds.includes(option.id))}
onChange={(event, newValue) => {
const selectedIds = newValue.map((option) => option.id);
setFieldValue("ruleIds", selectedIds);
}}
onBlur={handleBlur}
options={ruleEquation}
getOptionLabel={(option) => option.label} // Display the label for each option
/>
{errors.parentParam}
) : null
}
/>
{errors.defaultValue}
) : null
}
/>
);
};
export default CheckupParameterForm;
{
/*
*/
}