context = window @RescheduleLessonDialog = React.createClass({ mixins: [@PostProcessorMixin, Reflux.listenTo(@AppStore, "onAppInit")] teacher: false beforeShow: (args) -> logger.debug("RescheduleLessonDialog.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('reschedule-lesson-dialog', dialogBindings); componentDidMount: () -> @root = $(@getDOMNode()) getInitialState: () -> {id: null, lesson_session: null} onCloseClicked: (e) -> e.preventDefault() @app.layout.closeDialog('reschedule-lesson-dialog'); lesson: () -> this.state.lesson_session viewerStudent: () -> @lesson().student.id == context.JK.currentUserId viewerTeacher: () -> !@viewerStudent() render: () -> title = 'loading...' if this.state.lesson_session? title = "reschedule lesson" lessonSessionId = this.state.lesson_session.id other = this.state.lesson_session.other if @viewerStudent() && @sessionStartingSoon() title = 'Policy Issue' content = `
We’re sorry, but you cannot reschedule a lesson less than 24 hours before the lesson start time. This is not allowed in the terms of service because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.