import React, { Component } from 'react'; import { Form } from 'react-bootstrap'; import ReactDOM from 'react-dom'; export default class SettingsInput extends Component { constructor(props) { super(props) this.state = { type: this.props.type, name: this.props.name, value: (this.props.value) ? this.props.value : '', classes: this.props.classes, id: this.props.id, label: (this.props.label) ? this.props.label : false, readonly: true, description: (this.props.description) ? this.props.description : false, } } componentDidMount() { this.setState({ readonly: this.isReadOnly() }); } handleInput = (evt) => { var val = evt.target.value; if(this.state.type === 'checkbox') { val = e.target.checked; } this.props.handleInput( this.state.name.split(' ').join('_'), val ); this.setState({ value: val }); } isReadOnly = () => { if(window.config.editable[this.state.name] == false) { return true; } return false; } generateInput = () => { var disabled = (this.state.readonly) ? true : false; return