context = window

@CancelLessonDialog = React.createClass({

  mixins: [@PostProcessorMixin, Reflux.listenTo(@AppStore, "onAppInit")]
  teacher: false

  beforeShow: (args) ->
    logger.debug("CancelLessonDialog.beforeShow", args.d1)

    @setState({id: args.d1, lesson_session: null})

    rest.getLesson({id: args.d1}).done((response) => @getLessonDone(response)).fail((jqXHR) => @getLessonFail(jqXHR))

  getLessonDone: (lesson_session) ->
    @postProcessLesson(lesson_session)
    @setState({lesson_session: lesson_session})

  getLessonFail: (jqXHR) ->
    @app.ajaxError(jqXHR)

  afterHide: () ->

  onAppInit: (@app) ->
    dialogBindings = {
      'beforeShow': @beforeShow,
      'afterHide': @afterHide
    };

    @app.bindDialog('cancel-lesson-dialog', dialogBindings);

  componentDidMount: () ->
    @root = $(@getDOMNode())

  getInitialState: () ->
    {id: null, lesson_session: null}

  onCloseClicked: (e) ->
    @app.layout.closeDialog('cancel-lesson-dialog');


  render: () ->

    if this.state.lesson_session?
      title = "cancel lesson on #{this.state.lesson_session.music_session.scheduled_start_date} "
      lessonSessionId = this.state.lesson_session.id
      other = this.state.lesson_session.other

    `<div className="CancelLessonTop">
      <div className="content-head">
        <img className="content-icon" src="/assets/shared/icon_delete_sm.png" height={13} width={13}/>

        <h1>{title}</h1>
      </div>
      <div className="dialog-inner">

      </div>
    </div>`

})