Guest User

Untitled

a guest
Jan 5th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. class SideNav extends Component {
  2.  
  3. constructor(props) {
  4. super(props);
  5. this.state = {
  6. email: '',
  7. password: '',
  8. fullname: '',
  9. purok: '',
  10. userType: 'purokLeader'
  11. }
  12. }
  13.  
  14. state = {
  15. open: false,
  16. };
  17.  
  18. onOpenModal = () => {
  19. this.setState({ open: true });
  20. };
  21.  
  22. onCloseModal = () => {
  23. this.setState({ open: false });
  24. };
  25.  
  26. signOut() {
  27. firebaseApp.auth().signOut();
  28. };
  29.  
  30.  
  31.  
  32. signsUp() {
  33. // console.log('this.state', this.state);
  34. // const { email, password, fullname, purok } = this.state;
  35. // firebaseApp.auth().createUserWithEmailAndPassword(email, password)
  36. // .catch(error => {
  37. // this.setState({error})
  38. // })
  39.  
  40. // firebaseApp.database().ref('Usersyeah/').push({
  41. //
  42. // Fullname: this.state.fullname,
  43. // PurokNo: this.state.purok,
  44. // Email: this.state.email,
  45. // Password: this.state.password,
  46. // User: "purokLeader"
  47. //
  48. //
  49. // });
  50.  
  51. firebaseApp.database().ref('Usersyeah/').push({
  52. name: this.state.fullname,
  53. purok: this.state.purok,
  54. email: this.state.email,
  55. password: this.state.password,
  56. user: "purokLeader"
  57.  
  58. });
  59.  
  60. };
  61.  
  62. render() {
  63. const { open } = this.state;
  64.  
  65. return (
  66. <div className="container">
  67.  
  68. <div className="sidebar" style={sideBarColor}>
  69. <div className="logoCont">
  70. <img src={logo} className="sideLogo"/>
  71. </div>
  72.  
  73. <Link to="/" ><img src={home} style={{width: '30px'}} alt="Log Out image" /> Dashboard</Link>
  74. <Link to="/docproc"> Document Services</Link>
  75. <Link to="/sumbong"> Sumbong Center</Link>
  76. <Link to="/announce"> Announcement</Link>
  77. <div style={{ marginTop: ''}} ><Link to="#" onClick={() => this.onOpenModal()}><img src={logoutIcon} style={{width: '30px'}} alt="Log Out image" /> Add User</Link></div>
  78.  
  79. <div style={{ marginTop: '35px'}} ><Link to="#" onClick={() => this.signOut()}><img src={logoutIcon} style={{width: '30px'}} alt="Log Out image" /> Log out</Link></div>
  80.  
  81. </div>
  82. <div>
  83. <Modal open={open} onClose={this.onCloseModal} >
  84. <h4>Simple centered modal</h4>
  85. <input name="Name" id="fullname" type="text" ref="Fname" placeholder="Enter Your Fullname..." style={mainDivInput} onChange={event => this.setState({ fullname: event.target.value })}/>
  86. <input id="PurokNum" type="text" ref="PurokNum" placeholder="Purok No." style={mainDivInput} onChange={event => this.setState({ purok: event.target.value })}/>
  87. <input id="email" type="email" ref="Email" placeholder="Enter Your Email..." style={mainDivInput} onChange={event => this.setState({ email: event.target.value })}/>
  88. <input name="password" id="password" type="password" ref="Pword" placeholder="Enter Your Password..." style={mainDivInput} onChange={event => this.setState({password: event.target.value })} />
  89.  
  90.  
  91. <div>
  92. <button className="btn btn-primary" style={{height: '40px', marginTop: '100px', marginLeft: '330px'}} onClick={this.signsUp} >Create</button>&nbsp;
  93.  
  94. </div>
  95. </Modal>
  96. </div>
  97. </div>
  98. );
  99. }
  100.  
  101.  
  102. }
  103.  
  104. export default withRouter(SideNav) ;
Add Comment
Please, Sign In to add comment