import toastr from 'toastr';
import SeedCodeInput from './SeedCodeInput';
+import UserSelect from '../common/UserSelect';
import laravelErrorsToFormik from '../../helpers/laravelErrorsToFormik';
import i18n from '../../i18n';
import yup from '../../schema/yup';
: null}
</Form.Group>
</Row>
+ <Row>
+ <Form.Group as={Col}>
+ <Form.Label>{i18n.t('rounds.rolled_by')}</Form.Label>
+ <Form.Control
+ as={UserSelect}
+ isInvalid={!!(touched.rolled_by && errors.rolled_by)}
+ name="rolled_by"
+ onBlur={handleBlur}
+ onChange={handleChange}
+ value={values.rolled_by || null}
+ />
+ {touched.rolled_by && errors.rolled_by ?
+ <Form.Control.Feedback type="invalid">
+ {i18n.t(errors.rolled_by)}
+ </Form.Control.Feedback>
+ : null}
+ </Form.Group>
+ </Row>
</Modal.Body>
<Modal.Footer>
{onCancel ?
EditForm.propTypes = {
errors: PropTypes.shape({
code: PropTypes.arrayOf(PropTypes.string),
+ rolled_by: PropTypes.string,
seed: PropTypes.string,
title: PropTypes.string,
}),
onCancel: PropTypes.func,
touched: PropTypes.shape({
code: PropTypes.arrayOf(PropTypes.bool),
+ rolled_by: PropTypes.bool,
seed: PropTypes.bool,
title: PropTypes.bool,
}),
values: PropTypes.shape({
code: PropTypes.arrayOf(PropTypes.string),
game: PropTypes.string,
+ rolled_by: PropTypes.string,
seed: PropTypes.string,
title: PropTypes.string,
}),
mapPropsToValues: ({ round }) => ({
code: round.code || [],
game: round.game || 'mixed',
+ rolled_by: round.rolled_by || null,
round_id: round.id,
seed: round.seed || '',
title: round.title || '',
}),
validationSchema: yup.object().shape({
code: yup.array().of(yup.string()),
+ rolled_by: yup.string().nullable(),
seed: yup.string().url(),
title: yup.string(),
}),