content: import React, { Component } from 'react';
  import { FormattedMessage } from 'react-intl';
  import { Link } from 'react-router-dom';
  import { Row, Col, Form, FormGroup, FormControl, ControlLabel, Button } from 'react-bootstrap';
  import { AlertList } from "react-bs-notifier";
  import axios from 'axios';
  
  
  class EditAbhanga extends Component {
  
    constructor(props) {
      super(props);
      this.state = {
        abhangaNumber: '',
        abhangaTitle: '',
        abhangaContent: '',
        abhangaAuthor: 'mohandere'
      };
      this.handleSubmit = this.handleSubmit.bind(this);
      this.handleChange = this.handleChange.bind(this);
    }
  
    handleSubmit(event) {
      event.preventDefault();
  
      axios.post('/abhanga/edit', {
        index: this.state.abhangaNumber,
        title: this.state.abhangaTitle,
        content: this.state.abhangaContent,
        author: this.state.abhangaAuthor
      })
      .then(function (response) {
        console.log(response);
      })
    }
  
    handleChange(event) {
      const target = event.target;
      const value = target.type === 'checkbox' ? target.checked : target.value;
      const name = target.name;
  
      this.setState({
        [name]: value
      });
    }
  
    render() {
      return (
        <div className="text-left">
          <Form horizontal onSubmit={this.handleSubmit}>
            <FormGroup>
              <Col sm={2}>
                Index
              </Col>
              <Col sm={10}>
                <FormControl type="number" name="abhangaNumber" componentClass="input" onChange={this.handleChange} value={this.state.abhangaNumber} placeholder="Abhanga Number" />
              </Col>
            </FormGroup>
  
            <FormGroup>
              <Col sm={2}>
                Title
              </Col>
              <Col sm={10}>
                <FormControl type="text" name="abhangaTitle" componentClass="input" onChange={this.handleChange} value={this.state.abhangaTitle} placeholder="Abhanga" />
              </Col>
            </FormGroup>
  
            <FormGroup>
              <Col sm={2}>
                Content
              </Col>
              <Col sm={10}>
                <FormControl rows={15} name="abhangaContent" componentClass="textarea" onChange={this.handleChange} value={this.state.abhangaContent} placeholder="Abhanga Content" />
              </Col>
            </FormGroup>
  
            <FormGroup>
              <Col  sm={2}>
                Author
              </Col>
              <Col sm={10}>
                <FormControl name="abhangaAuthor" componentClass="select">
                  <option value="mohandere">Mohan Dere</option>
                </FormControl>
              </Col>
            </FormGroup>
  
            <FormGroup>
              <Col smOffset={2} sm={10}>
                <Button type="submit" bsStyle="primary">
                  Save
                </Button>
              </Col>
            </FormGroup>
          </Form>
        </div>
      );
    }
  }
  
  export default EditAbhanga;
  