<commit_before>import React, { PropTypes, Component }  from 'react';
import { Typeahead }                    from 'react-typeahead';
import _                                from 'lodash';
import cookie from 'react-cookie';

export default class AddOffer extends Component {
 
  constructor() {
    super();
    this.state = {data: []}
  }

  componentDidMount() {
    this.setState({companyNames: _.pluck(this.props.companies, 'name')});
  }

  handleSubmit (e) {
    e.preventDefault();
    let formData = {
      company_name: this.state.company_name.trim(),
      position: this.refs.position.value.trim(),
      salary: this.refs.salary.value,
      equity: this.refs.equity.value,
      total_funding: this.refs.total_funding.value,
      employees: this.refs.employees.value
    }

    this.props.postApiData('/api/offer', formData);

    this.setState({company_name: ''});
    this.refs.position.value = '';
    this.refs.salary.value = '';
    this.refs.equity.value = '';
    this.refs.total_funding.value = '';
    this.refs.employees.value = '';
    // this.refs.benefits.value = '';
  }

  checkCookie() {
    let usercookie = cookie.load('connect.sid');
    return usercookie;
  }


  render () {
    return (
      <div> 
      {this.checkCookie() ?
      <div>
        <h1 id="heading">Add Your Offer</h1>
        <form onSubmit={this.handleSubmit.bind(this)}>
          <div className="form-group">
            <label htmlFor="company">Company *</label>
              <Typeahead 
                className="form-control" 
                name="company_name" 
                options={ this.state.companyNames } 
                placeholder="Google" 
                maxVisible={10}
                onOptionSelected={
                  (name) =>  {
                    this.setState({company_name: name});
                  }
                } />
          </div>

          <div className="form-group">
            <label htmlFor="position">Position *</label>
            <input className="form-control" name="position" ref="position" type="text" />
          </div>

          <div className="form-group">
            <label htmlFor="salary">Salary *</label>
            <input className="form-control" name="salary" ref="salary" type="number" />
          </div>

          <div className="form-group">
            <label htmlFor="equity">Equity *</label>
            <input className="form-control" name="equity" ref="equity" type="number" />
          </div>

          <div className="form-group">
            <label htmlFor="total_funding">Total Funding *</label>
            <input className="form-control" name="total_funding" ref="total_funding" type="number" />
          </div>

          <div className="form-group"><commit_msg>Restyle autocomplete box in add offer form<commit_after>import React, { PropTypes, Component }  from 'react';
import { Typeahead }                    from 'react-typeahead';
import _                                from 'lodash';
import cookie from 'react-cookie';

export default class AddOffer extends Component {
 
  constructor() {
    super();
    this.state = {data: []}
  }

  componentDidMount() {
    this.setState({companyNames: _.pluck(this.props.companies, 'name')});
  }

  handleSubmit (e) {
    e.preventDefault();
    let formData = {
      company_name: this.state.company_name.trim(),
      position: this.refs.position.value.trim(),
      salary: this.refs.salary.value,
      equity: this.refs.equity.value,
      total_funding: this.refs.total_funding.value,
      employees: this.refs.employees.value
    }

    this.props.postApiData('/api/offer', formData);

    this.setState({company_name: ''});
    this.refs.position.value = '';
    this.refs.salary.value = '';
    this.refs.equity.value = '';
    this.refs.total_funding.value = '';
    this.refs.employees.value = '';
    // this.refs.benefits.value = '';
  }

  checkCookie() {
    let usercookie = cookie.load('connect.sid');
    return usercookie;
  }


  render () {
    return (
      <div> 
      {this.checkCookie() ?
      <div>
        <h1 id="heading">Add Your Offer</h1>
        <form onSubmit={this.handleSubmit.bind(this)}>
          <div className="form-group">
            <label htmlFor="company">Company *</label>
              <Typeahead 
                className="form-control" 
                name="company_name" 
                options={ this.state.companyNames } 
                placeholder="Google" 
                maxVisible={10}
                onOptionSelected={
                  (name) =>  {
                    this.setState({company_name: name});
                  }
                }
                customClasses={
                  { input: "typeahead-input",
                    results: "typeahead-results",
                    listItem: "typeahead-item",
                    hover: "typeahead-active"}
                }
                />
          </div>

          <div className="form-group">
            <label htmlFor="position">Position *</label>
            <input className="form-control" name="position" ref="position" type="text" />
          </div>

          <div className="form-group">
            <label htmlFor="salary">Salary *</label>
            <input className="form-control" name="salary" ref="salary" type="number" />
          </div>

          <div className="form-group">
            <label htmlFor="equity">Equity *</label>
            <input className="form-control" name="equity" ref="equity" type="number" />
          </div>

          <div className="form-group">
            <label htmlFor="total_funding">Total Funding *</label>
            <input className="form-control" name="total_funding" ref="total_funding" type="number" />
          </div>

          <div className="form-group">
{'fraction_non_alphanumeric': 0.14384270438082097, 'fraction_numerical': 0.0013797861331493618, 'mean_word_length': 1.9738461538461538, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '352717', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1623, 'n_words': 290}