 React = require 'react'
 BS = require 'react-bootstrap'
 Router = require 'react-router'
-Widgets = require 'react-widgets'
-Datepicker = Widgets.DateTimePicker
+Datepicker = (require 'react-widgets').DateTimePicker
 
-{TaskPlanActions, TaskPlanStore} = require '../../flux/task-plan'
+{TaskPlanStore, TaskPlanActions} = require '../../flux/task-plan'
 
 SelectReadings = React.createClass
   mixins: [BS.OverlayMixin],

      </p>
    </BS.Panel>

module.exports = Reading

      </div>
    </BS.Modal>

ReadingPlan = React.createClass
  mixins: [Router.State]

  getInitialState: ->
    {id: @getParams().id}

  componentWillMount: ->
    # Fetch the task if it has not been loaded yet
    TaskPlanStore.addChangeListener(@update)

  componentWillUnmount: ->
    TaskPlanStore.removeChangeListener(@update)

  update: ->
    @setState({})

  setDueAt: (value) ->
    TaskPlanActions.updateDueAt(@state.id, value)

  setTitle: (value) ->
    TaskPlanActions.updateTitle(@state.id, value)

  render: ->
    id = @getParams().id
