var React             = require('react');
var Dropdown          = require('react-select');
var $                 = require('jquery');
var SequenceActions   = require('../../../actions/SequenceActions');
var _                 = require('lodash');

var structure = null;

module.exports = React.createClass({
  getInitialState: function () {
    return {
      list:      []
    };
  },

  createSequence: function () {
    SequenceActions.create({
      type: structure,
      name: $('#sequence-title').val()
    });
  },

  _onSelect: function (selection) {
    structure = selection;
  },

  componentDidMount: function () {
    $('#sequence-title').trigger('focus');
    $('#create-sequence').on('click', this.createSequence);
  },

  componentWillUnmount: function () {
    $('#create-sequence').off('click', this.createSequence);
  },

  render: function () {
    var options = _.reduce(this.state.list, function (opts, item) {
      opts.push({
        value: item._id,
        label: item.name
      });
      return opts;
    }, []);
    return (
      <div className="table-center-wrapper">
        <div className="table-center item-new">
          <h1>add a sequence</h1>
          <input id="sequence-title" type="text" placeholder="sequence title" />
          <Dropdown options={options} onChange={this._onSelect} placeholder="sequence structure" />
          <button id="create-sequence">create!</button>
        </div>
      </div>
    );
  }
});
@@ -7,32 +7,34 @@
 act             
+  
 = require('react
@@ -51,32 +51,34 @@
 opdown          
+  
 = require('react
@@ -102,32 +102,34 @@
                 
+  
 = require('jquer
@@ -155,16 +155,18 @@
 tions   
+ 
+ 
 = requir
@@ -212,43 +212,76 @@
 var 
-_                 = require('lodash
+StructureConstants  = require('../../../constants/StructureConstants
 ');%0A
@@ -420,16 +420,354 @@
 ;%0A  %7D,%0A%0A
+  initStructures: function () %7B%0A    var key;%0A    var val;%0A    var structures = %5B%5D;%0A    var state = this.state;%0A    for (key in StructureConstants.types) %7B%0A      val = StructureConstants.types%5Bkey%5D;%0A      structures.push(%7B%0A        value: val,%0A        label: val%0A      %7D);%0A    %7D%0A    state.list = structures;%0A    this.setState(state);%0A  %7D,%0A%0A
   create
@@ -1094,32 +1094,59 @@
 reateSequence);%0A
+    this.initStructures();%0A
   %7D,%0A%0A  componen
@@ -1268,185 +1268,8 @@
 ) %7B%0A
-    var options = _.reduce(this.state.list, function (opts, item) %7B%0A      opts.push(%7B%0A        value: item._id,%0A        label: item.name%0A      %7D);%0A      return opts;%0A    %7D, %5B%5D);%0A
     
@@ -1514,23 +1514,31 @@
 ptions=%7B
-options
+this.state.list
 %7D onChan

modify sequencenew to the new structures way