import React from 'react'; import PropTypes from 'prop-types'; import { Alert, Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Input, InputGroup, InputGroupAddon, InputGroupText } from 'reactstrap'; import { gettext } from '../../../utils/constants'; import { Utils } from '../../../utils/utils'; const propTypes = { toggle: PropTypes.func.isRequired, updateName: PropTypes.func.isRequired }; class SysAdminSetOrgNameDialog extends React.Component { constructor(props) { super(props); this.state = { name: this.props.name, isSubmitBtnActive: false }; } toggle = () => { this.props.toggle(); } handleInputChange = (e) => { const value = e.target.value.trim(); this.setState({ name: value, isSubmitBtnActive: value != '' }); } handleKeyPress = (e) => { if (e.key == 'Enter') { this.handleSubmit(); e.preventDefault(); } } handleSubmit = () => { this.props.updateName(this.state.name); this.toggle(); } render() { const { name, isSubmitBtnActive } = this.state; return ( {gettext('Set Name')}
); } } SysAdminSetOrgNameDialog.propTypes = propTypes; export default SysAdminSetOrgNameDialog;