import React, { useState } from 'react';
import {
Accordion,
AccordionSummary,
AccordionDetails,
Typography,
FormControl,
InputLabel,
MenuItem,
Select,
TextField,
} from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import EditItemView from './components/EditItemView';
import { useTranslation } from '../common/components/LocalizationProvider';
import usePositionAttributes from '../common/attributes/usePositionAttributes';
import SettingsMenu from './components/SettingsMenu';
const useStyles = makeStyles(() => ({
details: {
flexDirection: 'column',
},
}));
const ComputedAttributePage = () => {
const classes = useStyles();
const t = useTranslation();
const positionAttributes = usePositionAttributes(t);
const [item, setItem] = useState();
const [key, setKey] = useState();
const options = Object.entries(positionAttributes).map(([key, value]) => ({
key,
name: value.name,
type: value.type,
}));
const handleChange = (event) => {
const newValue = event.target.value;
setKey(newValue);
const positionAttribute = positionAttributes[newValue];
if (positionAttribute && positionAttribute.type) {
setItem({ ...item, attribute: newValue, type: positionAttribute.type });
} else {
setItem({ ...item, attribute: newValue });
}
};
const validate = () => item && item.description && item.expression;
return (
}
breadcrumbs={['settingsTitle', 'sharedComputedAttribute']}
>
{item && (
}>
{t('sharedRequired')}
setItem({ ...item, description: event.target.value })}
label={t('sharedDescription')}
/>
{t('sharedAttribute')}
setItem({ ...item, expression: event.target.value })}
label={t('sharedExpression')}
multiline
rows={4}
/>
{t('sharedType')}
)}
);
};
export default ComputedAttributePage;