import * as React from 'react';
import Chip from '@mui/material/Chip';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import MenuItem from '@mui/material/MenuItem';
import Select from '@mui/material/Select';
import { styled } from '@mui/material/styles';
import ReportProblemIcon from '@mui/icons-material/ReportProblem';
import InfoIcon from '@mui/icons-material/Info';
import AutorenewIcon from '@mui/icons-material/Autorenew';
import DoneIcon from '@mui/icons-material/Done';
import {
GridEditModes,
useGridApiContext,
useGridRootProps,
} from '@mui/x-data-grid';
// eslint-disable-next-line no-restricted-imports
import { STATUS_OPTIONS } from '@mui/x-data-grid-generator/services/static-data';
const StyledChip = styled(Chip)(({ theme }) => ({
justifyContent: 'left',
'& .icon': {
color: 'inherit',
},
'&.Open': {
color: (theme.vars || theme).palette.info.dark,
border: `1px solid ${(theme.vars || theme).palette.info.main}`,
},
'&.Filled': {
color: (theme.vars || theme).palette.success.dark,
border: `1px solid ${(theme.vars || theme).palette.success.main}`,
},
'&.PartiallyFilled': {
color: (theme.vars || theme).palette.warning.dark,
border: `1px solid ${(theme.vars || theme).palette.warning.main}`,
},
'&.Rejected': {
color: (theme.vars || theme).palette.error.dark,
border: `1px solid ${(theme.vars || theme).palette.error.main}`,
},
}));
const Status = React.memo((props) => {
const { status } = props;
let icon = null;
if (status === 'Rejected') {
icon = ;
} else if (status === 'Open') {
icon = ;
} else if (status === 'PartiallyFilled') {
icon = ;
} else if (status === 'Filled') {
icon = ;
}
let label = status;
if (status === 'PartiallyFilled') {
label = 'Partially Filled';
}
return (
);
});
function EditStatus(props) {
const { id, value, field } = props;
const rootProps = useGridRootProps();
const apiRef = useGridApiContext();
const handleChange = async (event) => {
const isValid = await apiRef.current.setEditCellValue({
id,
field,
value: event.target.value,
});
if (isValid && rootProps.editMode === GridEditModes.Cell) {
apiRef.current.stopCellEditMode({ id, field, cellToFocusAfter: 'below' });
}
};
const handleClose = (event, reason) => {
if (reason === 'backdropClick') {
apiRef.current.stopCellEditMode({ id, field, ignoreModifications: true });
}
};
return (
);
}
export function renderStatus(params) {
if (params.value == null) {
return '';
}
return ;
}
export function renderEditStatus(params) {
return ;
}
export default renderStatus;