import {
	Box,
	FormControl,
	FormControlLabel,
	FormLabel,
	Grid,
	Radio,
	RadioGroup,
	Typography,
} from '@mui/material';

const ErrorManagement = ({ state = {}, handleChange = (name = '', val = '') => {} }) => {
	return (
		<Grid container spacing={1} flex mt={3} mb={3}>
			<Grid item flex={1} xs={4}>
				<Typography variant='subtitle1' fontWeight='bold'>
					Error management
				</Typography>
			</Grid>
			<Grid item flex={2} xs={8}>
				<Box component='form'>
					<Box component='div'>
						<FormControl>
							<FormLabel id='demo-radio-buttons-group-label'></FormLabel>
							<RadioGroup
								aria-labelledby='demo-radio-buttons-group-label'
								defaultValue={1}
								name='radio-buttons-group'
								value={state?.error_management}
								onChange={e => handleChange('error_management', e.target.value)}>
								<FormControlLabel
									value={1}
									control={<Radio />}
									label='Quote shipping using known shipping parameters, even if other items are missing shipping parameters.'
								/>
								<FormControlLabel
									value={2}
									control={<Radio />}
									label="Don't quote shipping if one or more items are missing the required shipping parameters."
								/>
							</RadioGroup>
						</FormControl>
					</Box>
				</Box>
			</Grid>
		</Grid>
	);
};

export default ErrorManagement;
