Guest User

Untitled

a guest
Feb 2nd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { Button, Input, Row, Col, Label } from 'reactstrap';
  3.  
  4. export default class Settings extends Component {
  5.  
  6. constructor(props) {
  7. super(props);
  8. this.state = { tallyPort: '', companyYear: '', interval: '', timeRange: '',
  9. databasePort: '', databaseUserName: '', databasePassword: '' };
  10. }
  11.  
  12. handleChange = (stateName, e) => {
  13. this.setState({ stateName: e.target.value });
  14. }
  15. handleSave = () => {
  16. console.log(this.state.tallyPort);
  17. console.log(this.state.companyYear);
  18. console.log(this.state.interval);
  19. console.log(this.state.timeRange);
  20. console.log(this.state.databasePort);
  21. console.log(this.state.databaseUserName);
  22. console.log(this.state.databasePassword);
  23. }
  24.  
  25. render() {
  26. return(
  27. <div className="dashboard" >
  28. <div className='container'>
  29. <Row>
  30. <Col sm="2"><Label><b>Tally Server Port</b></Label></Col>
  31. <Col sm="8">
  32. <Input placeholder="tally server port (e.g. http://localhost:9000/)" name="tallyPort" required onChange={this.handleChange.bind(this, 'tallyPort')} />
  33. </Col>
  34. </Row>
  35. <br />
  36. <Row>
  37. <Col sm="2"><Label><b>Company Year</b></Label></Col>
  38. <Col sm="8">
  39. <Input placeholder="Company Year" name="companyYear" required onChange={this.handleChange.bind(this, 'companyYear')} />
  40. </Col>
  41. </Row>
  42. <br />
  43. <Row>
  44. <Col sm="2"><Label><b>Interval For Pulling Data</b></Label></Col>
  45. <Col sm="8">
  46. <Input placeholder="Interval Time" name="interval" required onChange={this.handleChange.bind(this, 'companyYear')} />
  47. </Col>
  48. </Row>
  49. <br />
  50. <Row>
  51. <Col sm="2"><Label><b>Time Range For Pulling Data </b></Label></Col>
  52. <Col sm="8">
  53. <Input placeholder="Time Range" name="timeRange" required onChange={this.handleChange.bind(this, 'companyYear')} />
  54. </Col>
  55. </Row>
  56. <br />
  57. <Row>
  58. <Col sm="2"><Label><b>Database Port </b></Label></Col>
  59. <Col sm="8">
  60. <Input placeholder="Database Port" name="databasePort" required onChange={this.handleChange.bind(this, 'companyYear')} />
  61. </Col>
  62. </Row>
  63. <br />
  64. <Row>
  65. <Col sm="2"><Label><b>Database UserName </b></Label></Col>
  66. <Col sm="8">
  67. <Input placeholder="Database UserName" name="databaseUserName" required onChange={this.handleChange.bind(this, 'companyYear')} />
  68. </Col>
  69. </Row>
  70. <br />
  71. <Row>
  72. <Col sm="2"><Label><b>Database Password </b></Label></Col>
  73. <Col sm="8">
  74. <Input placeholder="Database Password" name="databasePassword" required onChange={this.handleChange.bind(this, 'companyYear')} />
  75. </Col>
  76. </Row>
  77. <br />
  78. <Button style={{ width: '200px', marginLeft: '720px'}} onClick={this.handleSave.bind(this)} color="primary">Save</Button>
  79. </div>
  80. </div>
  81. );
  82. }
  83. }
  84.  
  85. handleChange(stateName, e) {
  86. this.setState({ [stateName]: e.target.value });
  87. }
Add Comment
Please, Sign In to add comment