Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. import React from 'react';
  2. import './NewOrganization.scss';
  3. import Search from '../search/Search';
  4. import OrganizationDetails from '../organization-details/OrganizationDetails';
  5.  
  6. class NewOrganization extends React.Component {
  7. constructor(props) {
  8. super(props);
  9. this.showDetails = this.showDetails.bind(this);
  10. this.state = {toggleBlock: 'small-block',
  11. index: undefined,
  12. inn: undefined,
  13. kpp: undefined,
  14. ogrn: undefined,
  15. director: undefined,
  16. address: undefined,
  17. arrList: undefined,
  18. nameBack: undefined,
  19. addressBack: undefined,
  20. directorBack: undefined,
  21. innBack: undefined,
  22. kppBack: undefined,
  23. ogrnBack: undefined
  24. };
  25. this.saveOrganization = this.saveOrganization.bind(this);
  26. }
  27.  
  28. saveOrganization(name, address, director, inn, kpp, ogrn) {
  29. this.setState({nameBack: name, addressBack: address, directorBack: director, innBack: inn, kppBack: kpp, ogrnBack: ogrn});
  30. // this.props.getBackData(this.state.nameBack, this.state.addressBack, this.state.directorBack, this.state.innBack, this.state.kppBack, this.state.ogrnBack);
  31. alert(this.state.nameBack)
  32. }
  33.  
  34. showDetails(arrList, index, name, inn, kpp, ogrn, address, director) {
  35. this.setState({toggleBlock: "hidden", arrList: arrList, index: index, name: name, inn: inn, kpp: kpp, ogrn: ogrn, address: address, director: director});
  36. if (this.state.arrList !== undefined) {
  37. this.setState({arrList: undefined})
  38. }
  39. }
  40.  
  41. render() {
  42. let viewDetails = (<OrganizationDetails index={this.state.index} name={this.state.name} inn={this.state.inn} kpp={this.state.kpp} ogrn={this.state.ogrn} address={this.state.address} director={this.state.director} saveOrganization={this.saveOrganization}/>);
  43. if (this.state.index === undefined) {
  44. viewDetails = undefined;
  45. }
  46.  
  47. return (
  48. <div>
  49. <div className="main-block">
  50. <Search showDetails={this.showDetails}/>
  51. {viewDetails}
  52. <div className= {this.state.toggleBlock}>
  53. <i className="fas fa-plus-circle"></i>
  54. <div className="small-block__text">Для добавления новой организации введите ее название, ИНН или адрес</div>
  55. </div>
  56. </div>
  57. </div>
  58. )
  59. }
  60. }
  61.  
  62. export default NewOrganization;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement